MSBuild Xunit Targets

Hello world;

We have a Visual Studio 2012 solution that builds several projects including referenced projects.  The VCS Root is the lowest common path of the project paths.  The Checkout Rules include the relative path from the root for the project paths.

Build Step 1 - Visual Studio Runner type, works perfectly.  All of the projects are checked out and the build paths are created within the Agent working directy.  All of the projects build and the solution exe is created.

Build Step 2 (the problem) - One of the projects is an assembly of Xunit tests.  So the goal is to run Xunit with the test.dll as the assembly to test.

The first problem is the Targets: for the Build Step.  I can not find very much documentation or help on exactly what the value should be for this.  I am trying to enter the test.dll.  Since it's not in the Build File path I am entering the relative path.  But the build fails because the target does not exist.  If I try to use the full relative path from the VCS Root, I have another problem.  Part of the path has a space (PCS Next\Trunk....).  The build still fails because, again the target does not exist.  When I look at the log file, the space is replace with ";".  So naturally, if will not be found.

It may be my ignorance that I'm trying to use the Targets field for the wrong purpose, but again, I can not find any documents or examples.  So the first question is what exactly should this be?  How do I give the build the correct assembly to run the test runner on?

Beyond this question, if anyone can give me some guidance on how to properly setup Xunit (1.9.1) in TeamCity and then how to setup the TeamCity Build Step for this, it would be greatly appreciated.

We are using TeamCity Enterprise 7.1.1 (build 24074) with Visual Studio 2012 and Team Foundation Server 11.0.50727.1.  The only TeamCity agent is the default agent.  The operating system is Windows XP (will be moved to Windows 7)

I would be happy to provide any more information.



1 comment
Comment actions Permalink

Hi Mike.

A first step in troubleshooting such kind of issues is to make it work outside of TeamCity.

If you can start MSBuild from command line to run your xUnit tests, then TeamCity can do the same.
For tools like NUnit or MSBuild we have dedicated configuration pages, but xUnit has no special options. Just configure it within csproj-files, and run by MSBuild step.

Take a look at docs at xUnit site:
How do I run tests from MSBuild?
How do I see test results in TeamCity?


Please sign in to leave a comment.