XSLT Reports in Selenium - selenium

How to create XSLT reports in Selenium project bases on Java and Ant.
I have already added that to my project but the result is not as per my expectation. All Testcases are passing but some are showing failed in reports

XSLT reports can be generated based on the results of your TestNG.XML file. if you are using TestNG as unit testing framework make sure to place -output directory of the TestNG should be available in home directory.
Read this (http://learn-automation.com/generate-xslt-report-in-selenium/) post you will get better Idea.

Related

Automatically save JUnit test report in IntelliJ TestRunner XML / HTML format as a gradle task

I am currently running a huge bunch of JUnit tests on various Android devices using a standard gradle Android project, that was generated by Android Studio IDE (IntelliJ).
The tests are working fine and also the default JUnit reports in XML + HTML are being generated.
My problem with the generated report outputs: The standard outputs and the error outputs of all individual test are each being merged into two huge blobs.
However, I also noticed, that the test runner window has an option to export the Unit test results in its own XML and HTML export results.
And those exported versions of the JUnit reports do have separated outputs for the standard and error streams for each test.
I would like to know, if there is any available Gradle task or special already implemented TestRunner, that provides me with the same output, so I can generate those outputs automatically without manually doing those exports via the IDE 'Test runner' window.
My tests will be continuously run on a remote server with multiple attached Android devices with no supervision.
It would be awesome to have all test reports in the 'Test runner' XML + HTML versions, so someone can have a look at those outputs later on from the IDE itself (via the 'Import Tests from File...' feature) or in some browser.
I do have the default JUnit test report outputs, that are not helpful for later error analysis.
I did not attempt to write my own Runner implementation, that would mimic the IntelliJ XML output format, because it would be a maintainance horror to keep the output consistent to future IntelliJ updates.
I just hope for some hidden IntelliJ gradle task or some incubating gradle api, that just solves my problem.

Question on Jenkins Publish JUnit Test Result

I am using jenkins pipeline, does junit command once executed during build, stores the test results even after deleting the junit reports directory? If yes, where does Jenkins reads the deleted junit reports?
Jenkins does archive the JUnit test reports. So after your pipeline finishes (e.g. on an ephemeral agent), you'll still be able to access those reports. The same is true if you remove the report folder after you captured them with the plugin.
You can tell the JUnit plugin where to find your .xml Surefire/Failsafe reports. In a declarative pipeline, this can look like the following:
post {
always {
junit '**/target/surefire-reports/*.xml'
}
}
The source code of this plugin is available on GitHub, so you can take a look at how it's achieved under the hood.

How to target specific Cucumber runner classes or feature files within Jenkins?

Is it possible to target specific runner classes or feature files within Jenkins?
Let's say for example I have the following files.
Runner classes:
RunnerClass1.java
RunnerClass1.java
Feature Files:
Login.feature
SignUp.feature
Is there a way to trigger specific runner classes or feature files within the Jenkins UI, I know you can use specific plugins such as: 'Parameterised / String Parameters', has anyone else found a solution to target specific tests from Jenkins?
thanks for your help
You can tag your test cases and maven will be able to run them by these tags.
For example, When I have Login cases with #Login tags and I want to run them with Maven, I am using the following terminal script :
mvn clean test -Dcucumber.options="--tags #Login"

Test parallelism with IntelliJ and TestNG

I'm attempting to run some TestNG tests in parallel but don't have access to a testng.xml as IntelliJ builds it on the fly. I've tried adding parameters such as 'parallel=methods' to the run configuration but this doesn't appear to be making any difference.
How can I make TestNG run in parallel from IntelliJ without resorting to having to build my own testng.xml file?
I managed to get test methods to run in parallel without defining a custom testng.xml for each test by adding "-parallel methods -threadcount 20 -dataproviderthreadcount 20" in the "Test runner params" field of a TestNG run configuration.
It appears that you would be able to use the JDK Settings tab to specify "vm parameters", and then specify the parameters like so: -parallel methods -threadcount 2
However, IntelliJ actually creates an XML file and then uses that when running TestNG. That XML file has parallel="none" inside of it. As a result, the XML configuration 'wins' and you do not get the parallelization you are looking for.
There doesn't appear to be an easy way to adjust the contents of that default XML file, at least in terms of the parallelization options. You may just be stuck with creating XML suites yourself.
The best option for Intellij IDEA is to create additional testng.xml or you may run test from command line.
Another option is to use a 'Create TestNG XML' plugin. It instantly generates a testng.xml file so you don't have to customise one. Once installed, right click on your module name and you will see the 'Create TestNG XML' option.
You can't set this up with annotations. It must be configured in the XML. You need to set up an XML template. In eclipse it would be windows -> preferences -> testNG Template XML File.
Use an XML file that has all your parallel and usual optins and when you run as testNG it will replace only the section, while maintaining your other settings.

Integrate non-standard tests into TeamCity

I am trying to automate running some tests (in my own test infrastructure) with TeamCity.
We are not using java or ant but I can generate junit test results from a perl script:
run_tests.pl
Which generates junit result files (junit1.xml, junit2.xml etc.).
I have integrated this into Jenkins before by running it as a command line and giving it the path to the junit files.
In TeamCity it appears that due to the closer integration with ant and junit I need to run run_tests.pl from a ant junit task.
So how can I run a command from ant to do this? Or is there an easier way to achieve what I want (junit or other test results reported in teamcity)?
Okay, found a good way to do this. The key thing you need is XML Report processing so you don't need ant or junit tasks http://confluence.jetbrains.net/display/TCD7/XML+Report+Processing.
Summary:
Create your junit1.xml files using a command line build step
Add a build feature to your build configurations of type XML report
processing
Set report type to be ANT JUnit
Add a monitoring rule of +:junit*.xml