when .trx file is created in Coded UI Test - tfs

I am running a script through visual studio 2015 and checking for .trx file in test results folder.But I found the folder empty.
Can someone tell me when .trx file created.Only for Ordered Test or for both orderedtest and script running.

Based on my test, .trx file can be only created with running the test in command line. Script running can not generate the .trx file.
VSTest:
To log results into a Visual Studio Test Results File (TRX) you can use the option /Logger:trx. See VSTest.Console.exe command-line options for details.
MSTest : You can use the option /resultsfile:[ file name ] to save the test run results to the specified file.
Example: /resultsfile:testResults.trx
See MSTest.exe command-line options for details.

Related

Jmeter with ant - reports creation

I am trying to create report using ant in jmeter, meaning the full report.
I downloaded ant and it is installed as expected.
first I want to understand if ant command need to perform after test plan ran in the past? meaning it is offline process that creates the html reports? after the test plan finished?
Or is it command that actually used to run the test plan and create the html, meaning I do not need to run jmeter before?.
I used this command
jmeter -n -t C:\JMETER\Framework\Test_Fragment\Kung_Fu.jmx -l C:\Users\stackoverflow\Desktop\Jmeter_reports\results22_05_2018.csv
to run jmeter from command line, and create csv, so do I need two commands? one for creating csv and one for the ant? and if I create the csv where can I find the jtl of the testplan.
Name of test plan kung_fu
name of csv results22_05_2018.csv
what are the processes to run he ant, since I rename the Kung_Fu.jmx to test.jmx and put it in extras folder and when I command ant, it says test.jtl is not found.
can someone give a full explanation about the whole process
Rename results22_05_2018.csv into results22_05_2018.jtl and copy it to "extras" folder of your JMeter installation
Execute the following command in "extras" folder of your JMeter installation:
ant -Dtest=results22_05_2018 xslt-report
HTML report will be available as results22_05_2018.html
For more details see:
build.xml - reference Ant build file, by default it:
looks for Test.jmx file in the current folder
executes it and stores the result into Test.jtl file
applies XSLT transformation to the Test.jtl file and generates HTML file out of it.
JMeter Ant Task
Five Ways To Launch a JMeter Test without Using the JMeter GUI

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.

Include Build number in Jenkins test result file

I have a test project in Jenkins. And each time I build my project it says.
The results file "My File Path" already exists. Please specify a
different results file or verify the existing file is no longer needed
and delete it.
So I've decided to include the build number in the name of my result file.
And I'm using my result file to generate some graphical output also.
How can I include my Build Number in both locations
This is the windows batch command execution
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\mstest.exe"
/testcontainer:"%WORKSPACE%\TestAutomation\bin\debug\TestAutomation.dll"
/resultsfile:"%WORKSPACE%\results.xml"
And I'm using my result file as follows.
How can I change both these locations to add current build number in my result file as followingformat
result_BuildNumber.xml
Try this,
result_%BUILD_NUMBER%.xml - for batch
result_$BUILD_NUMBER.xml - for shell
BUILD_NUMBER is environment variable.

Jenkins with MSTest plugin : "mstest xml coverage report file not found"

In my build process, the VsTest.console tests my dll and generates a TestResults\a.trx file. The only parameter I added (more than dll path) is a .runsettings file.
The .trx file is not empty, the xml inside is quite explicit about what have been done. Double-clicking on the trx file opens vs2013 and results + coverage are displayed as it should.
Then, I want to publish the coverage results with jenkins MSTest plugin but it fails because it looks for a file that does not exists. Here are the output log :
MSTest: Processing tests results in file(s) TestResults\a.trx
MSTest: C:\Program Files (x86)\Jenkins\workspace\tepp\TestResults\a.trx
mstest xml coverage report file not found: C:\Program Files (x86)\Jenkins\workspace\tepp\TestResults\mstest-coverage.xml
Should it be better to use the MSTest-runner plugin ?
If not, what did I missed in my build process ?
The problem seems converting MSTest code covarage results in to XML
Have you tried something like TRX2HTML or TRXER ? (The convert them to htm so you can view using publish artifacts plugin)
TRXER
TRX2HTML
I also found this
Can you tell me your build steps?

TFS 2013 does not publish .coverage file on server

I'm developing a quality workflow with TFS 2013 and SonarQube 4.5.1. Everything works fine except one thing: I can't integrate code coverage data from TFS to SonarQube. The problem is that SonarQube needs .trx or .cover files to work.
However, my TFS Build doesn't publish those files. What I've done: I created a CodeCoverage.runsettings file that I mapped on my build with "User defined" type. (With CodeCoverageEnabled it doesn't work either.) In the file CodeCoverage.runsettings, I wrote the following XML tag:
<RunConfiguration>
<ResultsDirectory>.\TestResults</ResultsDirectory>
</RunConfiguration>
in the hope that it would write all the results files in the same directory. The build does indeed create the results directories, but none of them contain .coverage files. However, at the end of the build, in the results page, I can download a .coverage file. Do you know how I can force the writing of this .coverage file on the server? When I run analysis on my local config, the file is created in the test results directory.

Resources