Skip to content

jukafah/csharp-specflow-restease

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SpecFlow.RestEase

The goal of this project is to provide a good starting point for those looking to use SpecFlow and RestEase together. It is also intended to demonstrate how to implement design patterns in a test framework, where many test frameworks will violate many different principles like SOLID, Static Cling (this one is always the most common), and Explicit Dependencies.

Resources

Setup - OSx

Download and install Visual Studio or JetBrains Rider

The required .net frameworks should download/install with your IDE of choice.

JetBrains Rider

No extra setup necessary

Visual Studio

Visual Studio needs a little extra configuration. Install these extensions;

  • xUnit.NET 2
  • SpecFlow

Install Homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After installation:

$ brew doctor
Your system is ready to brew

Mono

$ brew install mono

Git

$ brew install git

Setup - Windows

Download and install Visual Studio or JetBrains Rider

The required .net frameworks should download/install with your IDE of choice.

JetBrains Rider

No extra setup necessary

Visual Studio

Visual Studio needs a little extra configuration. Install these extensions;

  • xUnit.NET 2
  • SpecFlow

Install Scoop (Windows Homebrew alternative)

Requirements

$ set-executionpolicy unrestricted -s cu

Install:

$ iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

Git

$ scoop install git

Clone

$ git clone https://github.com/jukafah/csharp-specflow-RestEase.git

IDE - Rider

As of writing this guide, generating the code-behind feature.cs files requires invoking the generator separately. Ken Bonny wrote a couple good articles for generating those and how to configure it with File Watcher. The guide will also walk you through associating the files together.

Generating SpecFlow Files in Rider

SpecFlow Steps Generation

Restore dependencies

$ nuget restore

From solution directory

$ mono "packages/SpecFlow.2.4.1/tools/specflow.exe" GenerateAll -p SpecFlow.RestEase/SpecFlow.RestEase.csproj

Import the generated feature.cs files to the same directory as your features.

Tests will now show in the Unit Tests / Test Explorer.

IDE - Visual Studio

TODO

Running Tests

You can run them in the Unit Test explorer of your chosen IDE or via command line

Build

$ msbuild

Run tests

$ mono "packages/xunit.runner.console.2.4.1/tools/net452/xunit.console.exe" SpecFlow.RestEase/bin/Debug/SpecFlow.RestEase.dll -xml ./TestResults/xunit.xml

Then you can generate a nice html report via Pickles

$ mono "packages/Pickles.CommandLine.2.20.1/tools/pickles.exe" --feature-directory=SpecFlow.RestEase/Features/ --output-directory=./TestResults/pickles --link-results-file=./TestResults/xunit.xml --documentation-format=dhtml --test-results-format=xunit2

About

Api testing with .NET and SpecFlow

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published