Is there a way to get a list of the jUnit tests that were run for the purpose of including that list in a report?
Rather than copying the 80 unit tests I ran, I was hoping to output it as html or a csv that I could then turn into a figure for my report.
Extra points if the pass/fail status of each test were included.
It depends how you run them, but if you're using maven, then the surefire plugin produces a report for you.
If you're using ant, see How do I use Ant to create HTML test reports?
Related
I have created a selenium webdriver project and I am using TestNg, Maven.
I want to generate report in excel format here. After searching online and looking at some videos I am using Xl.generateReport for excel report generation. I am looking at below video and have done the steps as shown in this video:
https://www.youtube.com/watch?v=1VVi185e6DI
So now I have my testng.xml file that has 2 test suites and total 5 testcases. After I run this testng.xml file, the console shows that all 5 testcases have been passed.
But when I see the report that is generated, it does not execute both the suites. It executes only one suite from testng file and skips one suite.
Also, the testcase pass/fail that is shown in excel report is wrong. It shows some testcase fail and some passed but the console in Eclipse shows all testcases are passed.
also the date of execution, the exceptions shown in excel report, all is wrong.
Thank you in advance.
I just had to update the Maven project and refresh the Reports folder to see valid test results.
It worked for me.
Thanks.
I have a Java program based on maven and for that I need to know the test coverage percentage. For testing, I am using testng.
I can already run the tests using command mvn test. All the tests are passing and I can see the report in surefire-reports/index.html. But I could not get the test coverage percentage that I need to supply for reporting.
mvn test
Expected result is Test Coverage Percentage is x%
You can use Intellij to get a coverage report. Right-click on a test folder: run all with coverage and here you go,
maybe you will need to call report window explicitly, it's located View -> Tool Windows -> Coverage. The last question about default plugin. The only information I can tell you about it is located in settings-> plugins:
For those Using Netbeans IDE, do the following
Right Click on the Project
Select Code Coverage
then choose Show Report
As shown Below
Code coverage for every file will be displayed.
How to take Test Run ID from Jenkins using selenium and Java.
Currently i`m using Extent Reports tool with Jenkins , Selenium and Java. Which generate reports after every test run.
But the problem is: Every test run It overwrites itself.
And i want to store test results instead of overwriting them.
Storing by date or time is a bad idea.
How i can Take Build # From Jenkins and Attach
it to
htmlReporter = new ExtentHtmlReporter("/Users/admin/"+jenkinsBuildNumber+"extent.html");
Extent report. That every test run will generate Unique Report which will be stored and i can easily track them by checking Jenkins Test Case run #.
use Jenkins environment variable ${BUILD_NUMBER}
final String jenkinsBuildNumber= System.getenv("BUILD_NUMBER");
Reporter=newExtentHtmlReporter("/Users/admin/"+jenkinsBuildNumber+"extent.html");
You can publish the reports generated by the Extent Reports tool in Jenkins.
Use HTML Publisher Plugin in Post Build Actions.
By default, only the most recent HTML report will be saved, but if you'd like to be able to view HTML reports for each past build, select "Keep past HTML reports."
This question shows how to run a TestNG suite programmatically without an XML file.
However, when I run it from IDEA it just runs as a main method and the output is not in the test window, whereas the JUnit example in the question does appear in the test window.
How can I configure a TestNG test suite from a Java class and have IDEA/Eclipse output the results in the test window?
You can't because IDEA uses its own TestNG listeners which are not available easily.
A potential option would be to create your own IDEA plugin based on the TestNG one.
About Eclipse, you can ask for the feature but I don't know if it will be accepted.
I'm trying to add a method in order to avoid the false positives from the jenkins run.
So i have many tests which are running in Jenkins and some of them are randomly failing and i want to find a way to tell the runner to restart that particular scenario and in case of success to update the report/result
I found something about: RestartingScenarioFailure but is not really working as i want, i mean its throwing me an exception, which i dont want.
I'm using serenity with JBehave and Junit
If you are using Maven take a look at Maven Failsafe plugin Rerun Failing Tests feature:
http://maven.apache.org/surefire/maven-failsafe-plugin/examples/rerun-failing-tests.html
max.retries=1
junit.retry.tests=true
This is a quick solution... not the best but at least is out of the box, you just need this two lines inside the serenity.properties