Giter Club home page Giter Club logo

specflow.dnx's Introduction

SpecFlow.Dnx

The problem

As at the time of writing (November 2015), the SpecFlow for Visual Studio 2015 extension does not play well with DNX projects (.xproj).

The solution

Wait for the VS extension to support DNX projects. In the meantime, I present...

The (hopefully temporary) solution

Update your project.json:

  1. Include SpecFlow.Dnx:
	"dependencies": {
		"SpecFlow.Dnx": "1.0.0-*"
	}
  1. Add a command:
	"commands": {
		"specflow-dnx": "SpecFlow.Dnx"
	}
  1. Add a prebuild script to call your command:
	"scripts": {
		"prebuild": [ "dnx specflow-dnx" ]
	}

Visual Studio

As of DNX RC1, you have to "produce outputs" to pipe the build through dnu:

image

image

Command line

You can run manually with dnu build (or just call dnx specflow-dnx on it's own):

image

Supported frameworks

  • dnx451
  • dnx46

PR's to add support for other frameworks are welcome as long as they include an accompanying sample.

Samples

If you build the samples solution, you should see .feature.cs files and an app.config being generated.

Test Frameworks

The auto-generated app.config is configured to use xUnit:

<unitTestProvider name="xUnit" />

This can be changed as per the SpecFlow Configuration Documentation, however (at time of writing) no other test frameworks are available for DNX.

Test Explorer

xUnit has been updated to work both with DNX and the Visual Studio Test Explorer. In order to make your project compatible with Test Explorer, please follow these steps:

  1. Add a dependency to xunit. (At time of writing, version 2.1.0)
  2. Add a dependency to xunit.runner.dnx. (At time of writing, version 2.1.0-rc1-build204)
  3. Add a command to execute the xunit runner:
"test": "xunit.runner.dnx"

Note: It is important that the command used is "test". This is a convention used by Test Explorer, and will not work without it.

Here is a complete sample project.json for reference:

{
	"version": "1.0.0-*",
	"dependencies": {
		"SpecFlow.Dnx": "1.0.0-alpha8",
		"xunit": "2.1.0",
		"xunit.runner.dnx": "2.1.0-rc1-build204"
	},
	"commands": {
		"create-specs": "SpecFlow.Dnx",
		"test": "xunit.runner.dnx"
	},
	"scripts": {
		"prebuild": "dnx create-specs"
	},
	"frameworks": {
		"dnx46": { }
	}
}

Examples in Test Explorer:

image

Generating step definitions

One of the nice features from the VS extension is being able to easily generate stubs for missing step definitions. This is still kind of possible, but definitely not as nice as the typical usage from the extension.

So, a feature file:

image

Build to generate the .feature.cs file and run it:

image

Right-click and Copy All:

image

Paste in your text editor of choice, then copy out the actual steps:

image

Given this should be a short-lived solution, hopefully this workaround is tolerable.

Background

specflow.dnx's People

Contributors

stajs avatar smudge202 avatar revlucio avatar bowman-jm avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.