How do you run SpecFlow scenarios from the command line using MSTest?

后端 未结 5 774
一向
一向 2020-12-01 19:06

I\'ve got Visual Studio 2010, and we have two VS solutions we work with. The first is the web application, and the second is strictly for SpecFlow tests. Having two instance

5条回答
  •  醉梦人生
    2020-12-01 19:36

    With MSTest v2, you can´t use mstest. You can use vstest.console.exe instead.

    Example:

    vstest.console.exe "Automation.SpecFlow\bin\Release\Automation.SpecFlow.dll"

    https://docs.microsoft.com/en-us/visualstudio/test/vstest-console-options?view=vs-2019

    If you want to run all scenarios in a single feature file, then add the /trait flag:

    vstest.console.exe "Automation.SpecFlow\bin\Release\Automation.SpecFlow.dll" /trait:"My Feature"

    And this runs all scenarios in the feature files that begin with:

    Feature: My Feature
        In order to ...
        As a ...
        I want to ...
    
    Scenario: 1
        ...
    
    Scenario: 2
        ...
    

提交回复
热议问题