Unit testing for a .NET app using Jazz Build Engine/RTC
Hello,
I have been building a .NET application in C# and so far, have implemented https://jazz.net/wiki/bin/view/Main/SCM15MinutesDemo with email notification. I was trying to get Unit test thing working, but noticed on internet and everywhere that Ant supports JUnit, hence stuck again :( Is there a way to use ANT Tasks for UNIT Testing ??? Please help.. Somethings which I tried was, executing UnitTests.dll using MSTest.exe ( using "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe" /testcontainer:E:\build\Source\MyProject.UnitTests\bin\Release\MyProject.UnitTests.dll /resultsfile:E:\buildscript\results.xml ).It did not help me much, still trying .. (was I on right track, or need something else to do???) EVENTUALLY, I want a HTML test report. I am also not able to build solution in Release mode, and Release folder is not getting created along with debug folder in the bin of project. Is ( "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" MyProject.sln /Rebuild Release ) , the way to build solution in release mode (when the command is used the batch file)? I am not sure, how to get UNIT Test thing implemented for C# application here.. Please guide, EVENTUALLY, I want a HTML test report created.Is there a way to use ANT Tasks for the same? or something else? Please guide/suggest/help, if possible, with CODE SNIPPETS etc? Thank you.. Regards, Geny |
One answer
Hi,
The command you are using to build the solution is correct but to build the solution in a given configuration, that configuration should be defined in the solution. Check the Build configurations of the projects in Visual Studio and make sure that the "Release" configuration is defined for the projects/solution and the output directory for the Release configuration is set correctly. If you are using RTC Version 2.0.0.2 you can use the ANT tasks to upload the MSTest result to a build result. The test results file will be parsed and the individual test results will be displayed under the "Junits" tab of the build result page. To achive this you need to add the following definition/target to the jazzbuild.xml file:
Example call to this ANT task from a BAT file would be
Note that MSTest generates a file with "trx" extension as the test result file, this file will be in XML format not HTML. I dont think MSTest generates a HTML file as output. If you are using RTC version earlier then 2.0.0.2 then this ANT task of publishing a MSTest results file is not available. In this case you can use the "artifactFilePublisher" ANT task to upload the file to the build result. You need to modify the "jazzbuild.xml" file and parametrize the "artifactFilePublisher" task to take a file path as input, currently the file path is hardcoded in the example "jazzbuild.xml" file. If you open the build result from VS and click on the uploaded MSTest result file, it will open within VS and you would see the test results in the VS Test view. Hope this helps. Thanks, Kishore Hello, |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.