Unit tests aren't getting run

I am new to Team City and trying to figure things out.

First, I have tried Pre-Tested Commit.  It commits to the svn repository ok, but I don't think the nunit tests are being run.  I say this because I have a test that is forced to fail.  Plus, I don't know how the tests would run because I can't figure out how to tell TeamCity where the tests are in the first place.  How do I configure this?

Second, I thought that I could have a CI build that runs unit tests (nunit) set up via the TeamCity interface and not specified in an MSBuild task.  But again, I can't figure out how to enable unit tests bia my build configuration.  I'm assuming I need to "turn on" testing somehow, and configure the build to know where the nunit test dlls are in my project.

Any ideas?  Thanks for the help.  I'm not finding the documentation to be very helpful.  I'd love to find a site with some nice tutorials.

5 comments

In TeamCity 5.0.x you could only enable NUnit running for sln2005 and sln2008 build configurations.
To make NUnit tests run in msbuild runner you will need to use <NUnitTeamCity> task.
Please see http://confluence.jetbrains.net/display/TCD5/NUnit+for+MSBuild for details.

If you use TeamCity 5.1.x build you can enable Run NUnit Tests section of you MSBuild or Visual Studio (sln) build runner settings and configure the paths for NUnit there.
Thanks!

0

Thanks for your response.  I think that helps clarify how I'll use NUnit for my normal builds.

But I'm still lost when it comes to Pre-Tested Commit.  It appears that for Pre-Tested Commit, there is no MSBuild script.  I configured the VS2008 plugin with some basic SVN settings.  How will it know which tests to run prior to the commit?

Regards,

Andy

0

Andy,

Pre-Tested commit is a feature to run any build configuration with your panding changes.
To make it work with NUnit you just need to setup a build configuration with NUnit test. And that select this build configuration from IDE plugin to run your pre-tested commit.

If you use sln2008 build runner:
- open build runner setting,
- add path to assemblies to run NUnit tests with on sln2008 build runner settings
- run the build (not pre-tested commit) and make use you see some tests reported.
- now it is time to start pre-tested commit for this build configuration. Now your pre-tested commit will run NUnit tests in the same way as it was done in the non-pre-tested commit build.

If you use MSBuild runner, please try switching to sln2008 build runner to try the features.

0

I see now.  I did not understand about the sln2008 build runner.  Now it is starting to make sense.

My pre-tested commit is working as well.  However, there is no option to set the build configuration from the visual studio plugin!  I'm not sure how it knows to run the tests but it does seem to work.  Any ideas on that?

Thanks very much.

0

When you select changes on Local Changed tool window and press pre-tested commit button you will be show the list of build configurations to send you changes to. You do not need to create new build configuration from Visual Studio.

0

Please sign in to leave a comment.