views:

27

answers:

1

I'm trying to work out how to run xUnit tests from TFS 2010.

I found some articles on how to achieve that with the older version (http://jonnekats.wordpress.com/2009/05/07/integrate-xunit-tests-into-your-daily-team-build/, http://weblogs.asp.net/mehfuzh/archive/2009/08/25/configuring-team-build-using-xunit.aspx). These approaches don't work anymore with TFS 2010 because builds are no longer MSBuild files but instead are Workflows with different tasks.

What I would like to achieve is something similar to what I've got on my dev machine: - build everything - run the .xunit project file - check the results

All that I can see on the web are custom build steps which I can't/won't use because I'll have to configure them for each single unit test assembly and they'll probably get completely messed up in TFS.

Any input would be appreciated.

+1  A: 

Why dont use "InvokeProcess" in TFS Build workflow and invoke xUnit command line interface with the necessary xUnit project files as parameters?

You can capture the output of the command line by setting InvokeProcess->stdout to write a build message.

Ngm
I'd like my build to fail in case the unit tests fail. If there's a way of doing that this easy solution is OK by me. I'm completely clueless about the whole build process though :(
R4cOON
Check the Environment.ExitCode of xUnit command line, if it returns a different exit code when unit tests fail as compared to when unit tests succeed, you can then write use WriteBuildError to make the build fail
Ngm
I ran into a very annoying and time consuming bug. I did as you suggested and added a new template from the "edit build" dialog. I couldn't see the new task running. It turns out TFS was not picking up the current version. The changeset of the file didn't change although I could see the changes are there. I copied the file and imported it into TFS and it worked.
R4cOON
Glad it helped.
Ngm
I decided to wait a bit more to go with the solution. I had forgotten that TFS put everything it builds into a big bag of assemblies. I can't reuse my nice xunit project that I created for my solution.
R4cOON