Search code examples
jenkinscontinuous-integrationgitlabmstestgitlab-ci

How to exclude tests using "/Category" from mstest on Jenkins


Before you point me out the other questions please read on...

I am running a mstest argument from Jenkins (not sure if this at all relevant) and want to exclude tests that do not belong in a particular category. Including tests in a category works a treat using the /category:CI but when i use it to exclude test using /category:!CI it doesnot work. It just says no tests to execute. I am %110 sure that there are tests in my container that are not in this category. I am using mstest test for VS2010.

mstest.exe /testcontainer:%%i /runconfig:%TestSettingFile% /category:"!CI" /resultsfile:Results.trx

Any idea what I might be doing wrong

EDIT I have found that this command doesn't work when running it from Jenkins but it works fine through cmd on the local box - any current bugs with Jenkins in regards to this?


Solution

  • Interestingly enough putting the category as the last argument seemed to have worked. Try moving the arguments if you are seeing the same issue.

    EDIT

    I only leave the answer above as a reference even though it is totally incorrect.

    As it turns out Jenkins batch command ignores " ! " mark so to escape it i had to use a " ^ " character.

    so my category is now listed as /category:"^!CI"