The Build Summary Cannot Display Test Coverage - tfs

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.

Related

SoapUI test execution returns error "The directory name is invalid"

I have an established CI pipeline comprising (prior to deployment):
TFS build
JFrog Artifactory for build artifact management
SoapUI and SpecFlow (BDD & itaretive, parameterised) for web service functional test automation
I have no access to our build agent servers and no permission to install anything thereon. Instead, I've added the SoapUI binaries as links to my functional test project; the binaries are pulled from source control in the Get Sources step of every build.
This works okay but it greatly increases the footprint of my test project (and any other test project for which SoapUI would be required), and by extension, the execution time of the build: functional testing will only execute on a small fraction of the builds executed (only if application codebase has changed or sufficient time interval since last full build and test has elapsed).
For these reasons, I opted to remove the SoapUI binaries folder from my test project and instead deploy a SoapUI binaries zip archive to an Artifactory repository. With the addition of a PowerShell script step in my build definition, I can pull the SoapUI binaries as needed and extract to the desired location on the build server. Foolishly, I thought this might be straightforward...
I did manage to push the zipped SoapUI binaries folder to the Artifactory repo, and, in my Development build definition, I did manage to correctly script my PowerShell step to pull the zip archive and extract its content successfully to he same folder in the build binaries directory on the build agent server as it had been located originally.
However, when I execute my build, in the step where the SoapUI tests are executed, on the first test iteration, I see the following error returned to build console:
System.ComponentModel.Win32Exception: The directory name is invalid
I added a PowerShell scripted filtered folder content step before the test execution step in both my Development (new) and my Production (original) builds for comparison. Both show the required 'testrunner.bat' to be present, in the same folder on the build agent server.
The test project itself has been unchanged (except for the removal of the SoapUI binaries folder).
To summarise:
I'm trying to execute SoapUI tests in two builds; in each build, the same test project is used and the SoapUI binaries are in the same location when the test execution kicks off.
One build executes successfully without issue.
One build fails at test execution step, returning error "System.ComponentModel.Win32Exception: The directory name is invalid".
I'm very puzzled by this; insights and SoapUI wisdom most welcome.
Thanks for looking.
Turned out, there was a discrepancy in the directory paths on the testrunner.bat between the builds; a '_' where a '-' should have been

Jenkins Conditional Build

I am completely new with Jenkins and have this question. So I created two projects on Jenkins. The first project will fetch from github if it notices any kind of change on my repo and will store a local copy on my machine.
The second project will start only if the first project is stable. If it is stable, the second project will first compile the all the java files (which I put in a compile.bat file), then it will run the testng.xml file which runs junit test and selenium test (run.bat file).
So what I want to do is if there is no compilation errors on compile.bat, then proceed on run.bat, but right now even though there are some errors on the java file and when the compile.bat runs, it catches those errors, Jenkins still proceeds to the run.bat file and at the end passes the build. I want the build to fail when there is any kind of errors.
Here is the link to my repo for the batch file and other files if that helps:
https://github.com/na2193/Demo
I had figured it out. You need to use conditional step(single) and there you can define what you want to do

No test result files were found using search pattern '...\**\TEST-*.xml

I am running my test in TFS (Nunit plus Visual Studio with Adapter) and I have set the build definition as below
Build succeeds but no test result file was generated
Does TFS writes this Xml file ?
Log
2017-02-08T08:08:40.8151428Z Executing the powershell script: D:\A1\agent\tasks\PublishTestResults\1.0.20\PublishTestResults.ps1
2017-02-08T08:08:41.0963795Z ##[warning]No test result files were found using search pattern 'D:\A1_work\1\s**\TEST-*.xml'.
If the Nunit plus Visual Studio with Adapter means you have two test steps: one for unit tests and the other one for vs tests.
Please also add two "Publish Test Results" step one for Nunit format.
Also run your test manually on the build server to see if test result file .trx generated on the machine.

Unable to find the project path for mstest.exe/tcm.exe

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.

OpenCover- Open cover saying missing PDBs when working with vstest.console.ex in tfs build definiton

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.

Resources