With mstest, can I run my unit test package for each of my supported languages?

We use .resx files to internationalize our application in several languages. Our automatic unit tests are in their own assembly, and we run mstest in this project from the command line from our CI (Jenkins) as follows:

mstest.exe / testcontainer: unittests.dll / category: "! TemporaryExclude" /resultsfile:UnitTests.trx

We found cases where individual unit tests failed if they were run on a machine installed in one of our cultures that are not supported by the English language. We would like our CI to run unit tests against each culture, including the current en-us one. This should be a problem that other people face, but I did not find anything on it.

Is there a way to run mstest against a specific culture? I did not see anything in the command line documentation for mstest.exe

I know that in my tests I could specify Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture, but I do not want developers to have to copy duplicates of their tests, one for each culture. It would be extra work for them, and duplication that is only culturally different would be difficult to maintain and error-prone.

I wondered about the derivation of the class from TestMethodAttribute and that it cycles through all my language DLLs, running the test code once for each, but Visual Studio tells me:

Error 2 'ClassToExtendTestMethodAttribute': cannot be inferred from the closed type "Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute"

Same thing for TestClassAttribute.

+5
1

, TestInitialize Thread.CurrentThread.CurrentCulture unit test ( ). , mstest (, "en-us" "fr-FR" ) .

, Unit Test Extensibility Sample", , .

+3

All Articles