I am new to Spock and need to figure out if I can customize the XML test report file generated by Spock. As far as I could figure out so far, I can enable generating JSON report file in which I would have access to all tests' start and end time.
I have integrated Spock with Jenkins and I am able to see the generated test reports after each build. I am wondering if there is a way by which I can customize this report to include start and end time?
Is there any way by which I can
include my own defined parameters into the test results
have Jenkins to show also my defined parameters in the report
Here is an example of what I want to have
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="SpecName" tests="12" skipped="0" failures="2" errors="0" timestamp="2018-16-15T09:12:59" hostname="DESKTOP-VANP1TU" time="0.864">
<properties/>
<testcase name="FeatureName" classname="SpecName" time="0.116" startTime="2018-16-15T09:12:59" endTime="2018-16-15T09:12:59"/>
.
.
.
</testsuite>
As you can see I have added two fields (StartTime and endTime) to the report.
the spock reports extension lets you define templates for your reports: https://github.com/renatoathaydes/spock-reports
with that at hand, you should also be able to define an XML template...
Related
I am trying to verify a XML response with rest-assured like this:
.then().body("some.xml.path", is("abc"));
However, what I get is a SAXParseException:
DOCTYPE is disallowed when the feature "http://apache.org/xml/features/disallow-doctype-decl" set to true.]
Response starts like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.021/cXML.dtd">
<cXML ...
Why am I getting this exception? What should I change?
I am using version 3.2.0 of rest-assured.
A similar question has been answered here. In short, the answer describes to use disableLoadingOfExternalDtd() to have RestAssured ignore the Document Type Definition in your XML.
Normally, the DTD would describe (using the external definition) the structural layout of the element defined as cXML.
If suite name contains dot, suite name in reporting is truncated.
The XML seems to have proper name as below
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:test-suite xmlns:ns2="urn:model.allure.qatools.yandex.ru" start="1424101948829" stop="1424102027462" version="1.4.4">
<name>SampleSuite.xml</name>
<test-cases>
<test-case start="1424101949080" stop="1424101952336" status="passed">
....
...
But html report(generated using allure.bat generate allure-results -v 1.4.0) is truncated as below:
Looks like not a bug. There happens extracting simple class name out of fully qualified one. Usually suite names look like "my.company.SimpleTest". In that case current behavior is more preferred.
I have an xml like below.
<Students college="SGS">
<Student id="001" name="ABC"/>
<Student id="002" name="XYZ"/>
<Students/>
<Students college="SPM">
<Student id="001" name="PQR"/>
<Student id="002" name="LMN"/>
<Students/>
and I want name of the student of the SGS college whose id is 001 using apache ant.
So how can I get this without using extra jar like xmltask.jar etc
The simplest solution is to use XPath to get this information. In Ant there is no built-in task to fetch XML data using XPath expressions. You would need to use tasks provided in external libraries:
https://code.google.com/p/ant-xpath-task/wiki/Introduction
http://ant.apache.org/external.html
Scenario:
We have an application with localisation capabilities for which we doing automated testing with an extensive Coded UI Test suite. The UI text reflects the user's selected main language, e.g. French.
We have a number of message assertions to check specific results, and as a result we have to cater for the localised environment.
I have started on creating the localised Resources.resx files (e.g. Resources.fr-FR.resx) and set the CurrentUICulture to fr-FR, but the English string is always retrieved. (The Properties.Resources.Culture is always null, and even if I force-set it, no success...)
Any ideas on how to achieve this or where I'm going wrong? Do I have to force-deploy the assembly with the localised text?
Thanks!
OK, so I figured this out:
For coded UI tests, all the necessary assemblies have to be in the ..\TestResults\uniqueTestInstance\Out folder. The language assemblies aren't copied here automatically, so what I've done is to add the following to my testsettings file:
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="RegressionCUIT" id="caf0f1b1-7dd7-4bbe-9920-edd664229791" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<Deployment>
<DeploymentItem filename="Resources\TestData.xml" />
<DeploymentItem filename="RegressionTesting\bin\Debug\de-DE\" outputDirectory="de-DE\" />
<DeploymentItem filename="RegressionTesting\bin\Debug\fr-FR\" outputDirectory="fr-FR\" />
</Deployment>
</TestSettings>
Note the outputDirectory attribute on the DeploymentItem.
Works brilliantly now.
Read more about file deployment here:
http://msdn.microsoft.com/en-us/library/ms182475.aspx
We're generating PartCover reports via the command line tool along with our CruiseControl.Net unit tests. This generates an xml file that displays the results nicely on the cruisecontrol dashboard. The xslt transforms that are included only show you the percentage of coverage in an individual class. We want to know exactly what lines are not being covered. The problem ist when we open the report in the PartCover browser and double click a method it doesn't show us our cs files. I know the PartCover browser is capable of showing you the files because of the following.
Here's a screenshot of PartCover browser with the lines of code showing: http://kjkpub.s3.amazonaws.com/blog/img/partcover-browse.png.
The information looks like it should be available to the browser because the report contains this:
<Method name="get_DeviceType" sig="Cathexis.IDBlue.DeviceType ()" bodysize="19" flags="0" iflags="0">
<pt visit="2" pos="0" len="1" fid="82" sl="35" sc="13" el="35" ec="14" />
<pt visit="2" pos="1" len="4" fid="82" sl="36" sc="17" el="36" ec="39" />
<pt visit="2" pos="5" len="2" fid="82" sl="37" sc="13" el="37" ec="14" />
</Method>
and this:
<File id="66" url="D:\sandbox\idblue\idblue\trunk\software\code\driver\dotnet\Common\AsyncEventQueue.cs" />
All I want to be able to do is view what lines of code are not being covered in my test cases without having to figure out what the xml above is trying to tell me.
Thanks to anyone in advance who replies.
I figured out why the cs files were not displaying. The paths were incorrect in the xml file because our test project was being built on a different machine than the one partcover was on. (partcover must generate the .cs file paths from pdb files maybe?) Once I search and replaced the file switching the base directory of our subversion location to the one on the other machine all was well.