I can successfully run the VS unit tests from the command line (and hence from the build on the build machine).
VSTest.Console.EXE "MyTest.dll" /logger:trx /platform:x64 /inIsolation
I can also filter out any required tests that I don't want to execute on a certain environment with /TestCaseFilter
option:
VSTest.Console.EXE "MyTest.dll" /TestCaseFilter:Name!=Verify_DigitallySigned
This is needed to not to run "check if digitally signed" test(s).
This way I can filter out the required set of test case/s.
However, what I want is to let the unit test know if certain tests (asserts) are not required. For example passing a "/DontTestSigning"
argument. This way the unit tests (written in C++ or C#) would see such parameter/option, and would not do additional asserts, thus preventing the build failures on not-real production builds (such as on PR builds).
I see that there is /testsettings
option with VSTest.Console.exe (and with MSTest.exe also), but I am not sure how (IF) that can be applied and letting the actual test functions to know about some "dont-do" option.