Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using vstest.console.exe TestCategory with equals and not equals

I am using SpecFlow to write Gherkin for automated UI tests. We have multiple tags (@smoke, @on, @off, etc.).

Test A has tags @smoke Test B has tags @smoke @off

These are translated to vstest test categories and do not include the @ symbol.

I want to run test A but not test B.

This is what is not working. It runs all @smoke tests.

Vstest.console.exe mytest.dll /TestCaseFilter:"TestCategory=smoke&TestCategory!=off"

Any ideas?

like image 870
Scope Creep Avatar asked Jul 01 '16 07:07

Scope Creep


People also ask

Does Visual Studio use MSTest or Vstest?

Visual Studio includes the VSTest and MSTest command-line tools for testing purposes. We can use both VSTEST and MSTEST to run automated unit and coded UI tests from a command line. 1.


1 Answers

I had two issues.

  1. I was executing the test with Thoughtworks Go which did weird things with the quotes before executing the command
  2. I needed to surround the entire condition with parenthesis as such: Vstest.console.exe mytest.dll /TestCaseFilter:"(TestCategory=smoke&TestCategory!=off)"
like image 56
Scope Creep Avatar answered Oct 04 '22 18:10

Scope Creep