问题
I'm trying out VS2015 and writing SpecFlow feature files. When I right click on the file, I cannot find "Generate Test Definitions" context menu. This happens only in "Class Library (Package)" which is obviously DNX 5.0 library.
Here is my project.json:
{
"version": "1.0.0-*",
"description": "",
"authors": [ "" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"SpecFlow": "1.9.0",
"SpecFlow.xUnit": "1.0.2",
"xunit": "2.1.0-beta3-build3029",
"xunit.extensions": "2.0.0"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.10-beta-22816",
"System.Linq": "4.0.0-beta-22816",
"System.Threading": "4.0.10-beta-22816",
"Microsoft.CSharp": "4.0.0-beta-22816"
}
}
}
And I have added SpecFlow Visual Studio 2015 extensions.
Am I missing something here?
But if I try the same in a normal Class Library that works fine.
回答1:
I would guess that SpecFlow is only supported on classic DotNet framework applications, the dnx format is too new/unstable to be fully supported yet.
Looking at http://www.specflow.org/documentation/Visual-Studio-2015-Integration/ gives hints that this integration may not be complete. (I note NuGet said the same thing only a few months ago http://blog.nuget.org/20150331/nuget-2.8.5.html).
Sorry this is all guess work.
You might want to raise this as an issue with them, https://github.com/techtalk/SpecFlow/issues.
回答2:
I found this little gem to provide a good bridge until Specflow sorts out this issue:
https://github.com/stajs/SpecFlow.Dnx
Be sure to read the ReadMe file!
回答3:
From SpecFlow documentation:
Right-click on your specification project (e.g. “MyProject.Specs”) and select Manage NuGet Packages for Solution. Search for “SpecRun” and install SpecRun.SpecFlow.
I made these steps and received 'Generate Step Definition' button. :)
来源:https://stackoverflow.com/questions/31182052/specflow-generate-test-definition-context-menu-missing-in-vs2015