.NET Framework Bookmark and Share   
 index > MSBuild > MSBuild - UnitTests Without TFS; Capturing Output
 

MSBuild - UnitTests Without TFS; Capturing Output

Hi, I'm probably just not getting my head around a number of posts I've read related to UnitTests from the build file, but I'd like to be able to invoke unit tests after the build and then capture the results from within the logger or a custom task, and then react according, e.g. e-mailing failed tests and test methods. A lot of posts I see are related to NUnit which we're not using. We use the Visual Studio TestTools. While we have TFS, and may use the Build Server, we're currently without the Build Server so I need to do this from the command line with the project file for now.

This link seemed like it would be useful:
http://blogs.msdn.com/buckh/archive/2006/11/04/how-to-run-tests-without-test-metadata-files-and-test-lists-vsmdi-files.aspx, but I couldn't get the Microsoft.TeamFoundation.PowerTools.Tasks.QualityTools.dll assembly that has the TestToolsTask method to run against a UnitTest. Any help would be appreciated.

Thanks
Zeb
Zebedatious
Hi Zeb,

Sorry for the delay.

Based on my understanding, you want to use command line to build a Test project, if so, you can use MSTest.exe which is the command-line command that is used to run tests, about how to use, please refer to following code:

MSTest /testcontainer:TestProject1.dll /test:TestProject1.Class1Test.TestMethod1 /unique.

For more information, please see this link:

http://msdn.microsoft.com/en-us/library/ms182489.aspx

If I misunderstood you, or you have any questions, please let me know.

Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
Nancy Shao
Hi Nancy, thanks for the reply. I should've mentioned I have looked at that method, however, although you can create an output or log file, in order to report on what failed in a post-build report process one would need to parse that output file. I was kind of hoping for a hook or something to capture events from some Unit Test "runner", so that if one of the unit tests fail, I can handle that from the MSBuild loggers. It seems from your response that this doesn't exist beyond a custom solution. If that's true, do you have any suggestions for how you might implement that? If this doesn't conform with best practice, what other methods, or what meansmight there be to aggregate more pertinent dataand reporton those? I'd basically like to go beyond sending an e-mail that says, pass/fail here's the log, particularly if there's a fail of course.

Thanks
Zeb
Zebedatious

You can use google to search for other answers

Custom Search

More Threads

• XML Docs out of MSBuild
• MSBee and toolsets
• Target (private)
• MSB3021 Copying error
• Copy bld output
• Extend not Override a target
• ReferencePath vbproj.user options
• Condition for output (verbosity) level
• DocumentationFile property getting ignored? MSBuild bug?
• New to MS Build ... Can any one get me a sample MS BUild file..