I tried to push the test result (*.trx) to MTM by command line. I used msttest /publish or tcm run /publish. With both I can't get the correct project path, anyone know how to find the path?
Attempted:
/collection:"mtms://companyName.visualstudio.com:443"
/teamproject:"MyProject/Testing/testplan"
Error: TF249051: No URL can be found that corresponds to the following
server name:
Tried to remove mtms:// and just used https://companyName.visualstatudio.com:
The following team project cannot be found:
How do I find out what is the correct project path?
The /publish command is used to associate test runs/results with builds. MTM is displaying test results that are associated with test plans/suites which are somewhat independent of builds.
/publish: [ server name]
Use the /publish option to publish test data to the database for the
team project collection associated with the project's Team Foundation
Server. When you use the /publish option, you must correctly specify
the name of the Team Foundation Server. The correct format depends on
whether the Team Foundation Server has been registered on the client
computer, as described here: Command-Line options for publishing test
results
Using this command the results will successfully published to build.The published result is viewed in your build summary, but they don't appear in MTM. There is no way to view the result in MTM. Please refer this similar question.
TCM is a command line interface to running tests, similar to mstest, but it runs the tests through the infrastructure you set up in MTM. To publish .trx files to MTM/TFS, you're going to have to use tcm.exe not mstest.exe to get what you're after. Sample command as below:
tcm run /publish /suiteid:XXXX /configid:X /resultowner:"ABC XYZ" /resultsfile:C:\TempResult.trx /collection:http://<<TFS URL>> /teamproject:"My Project" /runowner:"ABC XYZ" /build:<<Build Number>> /builddefinition:<<Build Definition Name>>
Note: please double check your server url is suitable.
Related
I have a problem trying to launch a server via a .bat file during a TFS build.
I usually launch the server via a cmd window and it works fine.
When I set it in the TFS build, I end up with the following message :
"'..\server_common.bat' is not recognized as an internal command or external, an executable or a command file".
I also have the following line:
"java -Dsun.lang.ClassLoader.allowArraySyntax=true -Xbootclasspath/a:..\..\..\lib\framework\serverjvm15.jar; -cp ..\..\..\lib\framework\fwtime.jar;" indicating a java syntax error (? I'm not skilled in java)
This batch calls other .bat files and sets java VM-related environment variables
From my research, it is probably a problem of rights as I don't have admin rights when I use TFS. However, all the other steps in the build work fine (installing and launching an appli through command lines, or launching a python script via command lines).
However I also tried to launch a basic script with the same kind of step and it works.
First, suggest you to follow the tutorial in Batch script. Make sure you have meet the requirements of Arguments and used correctly. Such as
Path
Specify the path to the .bat or .cmd script you want to run. The path
must be a fully qualified path or a valid path relative to
the default working directory. In Team Foundation Build, this
directory is $(Build.SourcesDirectory).
Also RDP to your build agent and use your build service account manually run the server_common.bat to narrow down if the account have enough permission.
I'm possibly in over my head here, but I've been asked to set up a scheduled Team Foundation Build for our team's branch and then after the build completes for our automated tests to be executed using NUnit.
I've had a look at a few online tutorials on setting up the build definition in TFS, but I can't seem to figure out how to call NUnit after the build is successful. I was expecting to see or find some kind of "run this command line on success" option somewhere; the best I could find is "Pre/Post-test script path", but that's related to tests like **\*test*.dll;**\*test*.appx and I'm not sure what that is.
Just knowing what to Google for would be a help, as I am at a loss now.
If you use XAML build:
You can either install the NUnit Test Adapter NuGet package in the unit test project. Or you can check the assemblies into the Build Controller's Custom Assemblies Path.
Useful article:
https://blogs.msdn.microsoft.com/visualstudioalm/2013/06/11/part-3-unit-testing-with-traits-and-code-coverage-in-visual-studio-2012-using-the-tfs-build-and-the-new-nuget-adapter-approach/
https://www.codit.eu/blog/2015/03/18/continuous-integration-with-javascript-nunit-on-tfsbuild-part-3-of-3-/
If you use new task based build:
You can add the NUnit Test Adapter NuGet package to your solution, and specify the path of NUnit Test Adapter NuGet package in the Path to Custom Test Adapters field in VSTest task. Check the screenshot below:
Useful article:
http://bartwullems.blogspot.sg/2015/10/team-foundation-server-2015enable-nunit.html
The problem happen after our on-demand TFS server upgrade to 2015 update 3. Before we are using Update 1, everything works fine. The problem is: in the build summary the unit test coverage section is empty and complain "No build code coverage data available. "
But actually, we enable the coverage inside the build task and the .coverage file already published from the build agent onto server during the task running. From the test run details, we can see in the attachment:
And in the task configure, we already check:
Some Update:
1. The VS version is already Enterprise version as the .coverage file is generated successfully.
2. Remove the test run setting file does not help.
I am trying to integrate Opencover with TFS2013 for custom code coverage. I am passing the parameters necessary for running Open Cover via build definiton nad invoking OC using a InvokeProcess activity in the build process template.
I am following the procees mentioned in
this blog , here and here.
The final OpenCover arguments passed are
OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" -targetargs:"<build_definition_folder>\bin\NUnitTestDemo.dll <build_definition_folder>\bin\UnitTest.dll /Platform:X86 /Framework:Framework45 /Logger:trx " -targetdir:"<build_definition_folder>\bin" -mergebyhash -output:"<build_definition_folder>\bin\results.xml"
The output is coming as
Total tests: 2. Passed: 2. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 0.6657 Seconds
Committing...
No results, this could be for a number of reasons. The most common reasons are:
1) missing PDBs for the assemblies that match the filter please review the
output file and refer to the Usage guide (Usage.rtf) about filters.
2) the profiler may not be registered correctly, please refer to the Usage
guide and the -register switch.
Please help me. The PDBs are present in the same bin folder only. I tried running Open cover locally in my machine with Open Cover UI and it is giving the results well. but with console application it is not working as i expected in the build server.
I met this issue before and it was because my build service is running with "Network Service" account. After I changed it to run with an administrator account, it works correctly, result is generated successfully.
My fix:
Stop the build service and change the settings in "Properties" to run the service as an Administrator account. And then start the build service and queue a new build.
I'm trying to get TFS to run my unit tests.
The name of the project assembly is Users.SystemTests.dll. It's located in ~/source/Users.SystemTests/bin/debug. The solution file is located in ~/source/Users.sln.
I've included the Nunit.VisualStudio.TestAdapter nuget package the in test assembly project.
The results of the build shows that the tests don't run.
What am I missing? They run fine locally via the Resharper test runner and I can also use nunit-console-x86.exe to run them.
Does this have something to do with the fact that I'm building a solution file? Maybe it's the output location being "AsConfigured?"
Ok, so I tracked this down on my own. It was twofold. The first problem was the the TestAdapter was not being output to the bin directory. The other piece was the Output Location. Setting copy local and then Output Location SingleFolder fixed the issue.
I do believe this is a bug in the tfs build. It works when you use SingleFolder or PerProject, but not AsConfigured. In the latter case the test runner don't find the testassemblies, and this is the same for both NUnit and MSTest, so it is not adapter specific.
The diagnostics log says:
Run VS Test Runner00:00:00
There were no matches for the search pattern C:\a\bin\**\*test*.dll
There were no matches for the search pattern C:\a\bin\**\*test*.appx