0

I would like to say thanks to everyone here ,because i am learning many things from stackoverflow...every time i am living with new energy ..its all here.

yes of course ,i need oxygen to breath again...all helping hands i want ...may be my questions are silly but really day to day am brushing and growing as kid of stackoverflow school.

i have little knowledge on working with c# project and unit test(Nunit/xunit)..where i use Nunit test to debug my code which i have written in c# project.

now i got a new challenge to do WCF service automation in BDD approach using specflow.

i tried by adding spec-flow features and steps for couple of scenarios into Nunit unit test project and was able to run and identified tests.

where as if i create same set of features and steps ,not identified any test and not run anything .even not recognized [Test] or [TestFixture].

let me explain what i have in mind, i want create all spec-flow features and steps in c# project and should be run this solution through nunit.exe/console by passing "REGRESSION" or "SMOKE" tests(by configuring environment details) in command prompt. and for debugging purpose i want call these spec-flow features (in c# project) from my unit test project...is this approach possible?

if possible ,please let me know with few sample and possible explanation/details to implement.

Issue: 1. I am not able to run any Spec-flow feature from c# project (since not test is identified) 2. Don't know how to call feature from unit test to do debug or to test my code before i integrate to team-city.

please consider all these my basic doubts and make me to learn.

Thanks In Advance,

kanna
  • 23
  • 1
  • 7
  • If you want to run through command line, you can mstest runner. http://stackoverflow.com/questions/20613221/how-do-you-run-specflow-scenarios-from-the-command-line-using-mstest – I Am Mar 14 '17 at 06:04

1 Answers1

0

In regards to your issue 1 and 2, I guess you are not able to see features in runlist and hence not able to execute.

if you are not able to discover specflow features in run list. You can try installing "Specflow for Visual Studio 2013" in extensions and updates. Please note this is in addition to "Specflow" package that you might have installed.

Specflow extension

Specflow feature

You will see such features that can be added and you will have to add steps implementation. Its not related or part of Unit tests.

I Am
  • 33
  • 1
  • 4
  • Added that also, but my doubt is shall i create spec-flow feature project in c# and unit test to call that project ? or should i need to create spec-flow feature in unit test itself? ...even now am not able to generate spec-flow steps from features..is there any solution or fix? – kanna Mar 14 '17 at 10:28
  • Specflow feature are different from Nunit tests. You cannot create feature in unit test itself. Once you have added proper extensions/plugins/nuget packages, you can "Add Item" and select "Specflow Feature". And then Add steps implementation. – I Am Mar 14 '17 at 13:46
  • I have added feature files in windows c# project instead under unit test ,so my test are not identified when run specflow features.so i got doubt that if we create feature files under unit test then only test will identified. is this true? – kanna Mar 14 '17 at 18:16
  • I am sorry, I guess I misunderstood. Yes, C# project type is "Unit Test Project" and under that you can create feature files and step files. – I Am Mar 15 '17 at 04:43
  • Thank you,unfortunately..am facing new issue again, specflow not generating any steps and not throwing any error also. cleared temp and /bin/debug as well but no use....any work around? – kanna Mar 16 '17 at 18:06
  • SpecFlow uses in the standard configuration NUnit. To get NUnit tests displayed in the Test Explorer, you need to install the NUnit Test Adapter for Visual Studio by NuGet Package or Visual Studio Extension. – Andreas Willich Mar 19 '17 at 11:27