Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can vstest.console filter tests by all matched traits?

As documented on this MSDN article, vstest.consolecan filter tests to run by traits. For example, a sample vstest.console command might look as follows:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\mytest.dll" /TestCaseFilter:"TestCategory=traitA|TestCategory=traitB|traitN" /logger:trx

Actually, the whole article says that multiple traits will be provided using the following syntax:

<Expression> is of the format <property>=<value>[|<Expression>].

My issue is when you provide more than a trait, tests are filtered using a logical or and official documentation says nothing about how to filter tests that match all given traits.

like image 413
Matías Fidemraizer Avatar asked Dec 18 '15 10:12

Matías Fidemraizer


1 Answers

Provided article has an undocumented expression format. If you use & instead of | to provide multiple traits, you're going to filter tests which match all given traits.

For example:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" "C:\mytest.dll" /TestCaseFilter:"TestCategory=traitA&TestCategory=traitB&traitN" /logger:trx
like image 57
Matías Fidemraizer Avatar answered Sep 30 '22 03:09

Matías Fidemraizer