6 comments

Hello Eugene,

Yes. Sure. It has support for MSTests for sln2005 and sln2008 build runners.
NUnit/NUnitTeamCity MSBuild tasks and nunit2 NAnt task should support MSTest
too (in case of running under TeamCity)

--
Eugene Petrenko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Does TeamCity have any support for MSTest?



0

How does this work?

I have a VS.NET project with several MSTest solutions and they do not get executed when a build is run in TeamCity.

0

I am also confused as to how to make this work. In the project config page I see options for NUnit but not mstest (I am using the sln2008). Even worse for me, when TeamCity tries to build my mstest project, I get the "unknown namespace Microsoft.VisualStudio".

Do you have to install Visual Studio on the build server to enable MSTest support?

0

I have this working in my environment using Visual Studio Solutions.

You must have the VS Testing platform available on the build agent. If you have machines that are able to do VST and some that aren't, modify the build agent's properties file (buildAgent.properties under \teamcity\buildagent\conf) to include an environment variable (env.VSTest=True). Then modify the agent requirements for the build (the 7th step under Build Configuration Steps) and Add a requirement for a variable. The variable name is simply VSTest and we choose the exists condition. Look at the agent compatibility box beneath and you will see what agents will build the application.

Next, recheck your solution - we made this mistake - and make sure that the build you are creating includes the test files. When we were building a Release, we didn't generate the test files. Rebuild within Visual Studio and make sure the test dll exists where you expect it to.

(back to Team City)

On the Runner tab (step 3),
NUnit Runner choose auto.
Run Tests from: *\VSUnitTests\\.dll (We place our tests underneath the project in a folder named VSUnitTests, adjust as necessary)
Do not run test from : *\obj\\.dll

Click Save.

Another 'gotcha' was our database connection, make sure the build runner user has access to any databases or you have defined a specific user within your configuration file.

Click Run

Your tests should now run.

0

Hello,
Please have a look/watch http://www.jetbrains.net/tracker/issue/TW-4862
This is about supporting VSTS tests for VS2008

Thanks!
--
Eugene Petrenko
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I have this working in my environment using Visual Studio Solutions.

You must have the VS Testing platform available on the build agent. If
you have machines that are able to do VST and some that aren't, modify
the build agent's properties file (buildAgent.properties under
\teamcity\buildagent\conf) to include an environment variable
(env.VSTest=True). Then modify the agent requirements for the build
(the 7th step under Build Configuration Steps) and *Add a requirement
for a variable*. The variable name is simply VSTest and we choose
the exists condition. Look at the agent compatibility box beneath
and you will see what agents will build the application.

Next, recheck your solution - we made this mistake - and make sure
that the build you are creating includes the test files. When we
were building a Release, we didn't generate the test files. Rebuild
within Visual Studio and make sure the test dll exists where you
expect it to.

(back to Team City)

On the Runner tab (step 3),
NUnit Runner choose auto.
Run Tests from: *\VSUnitTests\\.dll (We place our tests
underneath the project in a folder named VSUnitTests, adjust as
necessary)
Do not run test from : *\obj\\.dll
Click Save.

Another 'gotcha' was our database connection, make sure the build
runner user has access to any databases or you have defined a specific
user within your configuration file.

Click Run

Your tests should now run.



0

I'm curious which version of TeamCity you're using 'cause as far as I know there's no "auto" entry in the NUnit Runner options for the TeamCity build runner configuration page. You can choose "auto" as the Test Platform for not for the NUnit Runner.
I thought MSTest support had been shelved for the next release of TeamCity (4.0).

0

Please sign in to leave a comment.