ttutisani / Xunit.Gherkin.Quick

BDD in .NET Core - using Xunit and Gherkin (compatible with both .NET Core and .NET)
MIT License
205 stars 29 forks source link

Newbie: How to run test from command line #88

Closed brucekissinger closed 5 years ago

brucekissinger commented 5 years ago

I have used Cucumber with Java and Python in the past, but need to test a .NET console app. In the readme file there is a statement "If you use command line to run unit tests, simply run them as always. You should see the scenario full name in the results as a newly added unit test name."

Can anyone provide a specific example of how to do this?

If I run the command "dotnet test", I get a message "Starting test execution, please wait..." and then get a warning "No test is available in [DIRECTORY] Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again."

ttutisani commented 5 years ago

Hi @brucekissinger

If you get an error that "No test is available in [DIRECTORY]" then probably you are not standing in the directory where the solution is. Is that the case?

As a proof of concept, try downloading the source code and go to the /source path and run dotnet test command inside it. I just tried it and I see the results of all the tests, for regular unit tests plus BDD tests.

brucekissinger commented 5 years ago

Yes - you are correct. Works perfectly. I had my main source files in one directory and my feature file and test code in a different directory and was inside the test directory when I attempted to execute the tests.

ttutisani commented 5 years ago

Good. Please close the ticket if your question is answered and no other issues. I've also updated the home page readme file to specify what I meant by the command line execution. Next time there will be less confusion I think.