Stephen
Stephen

Reputation: 33

Running NUnit Tests in TFS 2010, Tests Run but Get Error Publishing Results

I have used the Community TFS Build Extensions to add NUnit test support to my build template in TFS 2010. I have created my build definition and my project is building fine. It also appears that my NUnit tests are completing however I am getting a "File Not Found" error when it tries to publish the *.trx test results file to TFS? I can't seem to work out where it;s going wrong and where to make any changes. The error is below:

Find files containing nUnit tests

NUnit Running C:\Program Files (x86)\NUnit 2.6.2\bin unit-console.exe /nologo "C:\Builds\1\gd_Chinook\ChinookEF_5_Build_Definition\Binaries\tcg.Chinook.Test.dll" /xml="C:\Builds\1\gd_Chinook\ChinookEF_5_Build_Definition\Binaries\outputxmlfile.xml" /out="outputfile.txt" Processing C:\Builds\1\gd_Chinook\ChinookEF_5_Build_Definition\Binaries\outputxmlfile.xml Running %VS110COMNTOOLS%..\IDE\MSTest.exe /publish:"link to our TFS build removed StackOverflow" /publishresultsfile:"C:\Builds\1\gd_Chinook\ChinookEF_5_Build_Definition\Binaries\outputxmlfile.trx" /publishbuild:"ChinookEF_5_Build_Definition_20130515.9" /teamproject:"gd_Chinook" /platform:"Any CPU" /flavor:"Debug" Error: The system cannot find the file specified. Stack Trace: at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at TfsBuildExtensions.Activities.CodeQuality.NUnit.RunProcess(String fullPath, String workingDirectory, String arguments) at TfsBuildExtensions.Activities.CodeQuality.NUnit.PublishMSTestResults(String resultTrxFile, String collectionUrl, String buildNumber, String teamProject, String platform, String flavor) at TfsBuildExtensions.Activities.CodeQuality.NUnit.PublishTestResultsToTFS(ActivityContext context, String folder) at TfsBuildExtensions.Activities.BaseCodeActivity.Execute(CodeActivityContext context).

Associate Changesets and Work Items Analyzing labels ChinookEF_5_Build_Definition_20130515.6 and ChinookEF_5_Build_Definition_20130515.9. The system cannot find the file specified

Any help or suggestions would be greatly appreciated if anyone has had this problem before.

Stephen

Upvotes: 0

Views: 335

Answers (1)

Stephen
Stephen

Reputation: 33

I have worked out the solution to my own problem. The root of the problem came from developing and creating build definitions with VS2012 and publishing to TFS2010.

The error I was receiving occurred when my test results were being published to TFS. The following command attempted to run and generated the error: Error: The system cannot find the file specified... (stack trace omitted from post):

%VS110COMNTOOLS%\..\IDE\MSTest.exe /publish:"http://artigas:8080/tfs/NorthernDevelopmentTeam" /publishresultsfile:"C:\Builds\1\gd_Chinook\ChinookEF_5_Build_Definition\Binaries\outputxmlfile.trx" /publishbuild:"ChinookEF_5_Build_Definition_20130515.9" /teamproject:"gd_Chinook" /platform:"Any CPU" /flavor:"Debug"

After some research I noticed that it was trying to run the command line from the VS2012 directory NOT the VS2010 directory. I was able to run the command manually if I changed %VS110COMNTOOLS%\ to %VS100COMNTOOLS%.

To get round this I installed VS2012 on the build server. I was hoping to avoid this and the build itself will work fine as long as you install .NET4.5 and other dependables. This did solve my problem however and my nUnit tests are now publishing!

Upvotes: 0

Related Questions