Invalid Report generation using Xl.generateReport in Selenium TestNG - java

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.

Related

How to get test coverage percentage for java maven based program?

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

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."

How Do I Run A TestNG TestSuite In IDEA/Eclipse Without An XML File?

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.

How to set up test suite using selenium webdriver eclipse and test NG

I am new to selenium and so i want to seek advice for setting up my framework.
What i want to achieve is i want a test suite setup using selenium webdriver and eclipse in testNG format. I am looking for a test suite that runs through all the test listed in there (I will record and export script to java/test NG format using IDE and tweak as needed). So that on single click i can run through a series of tests for regression testing. And generate a report stating what passed and what failed
Any ideas how to do it or set it up or any small code required to invoke that whole test will be appreciated.
Thanks
The following is a good tutorial on how to set up selenium webdriver and testNG framework.
http://www.toolsqa.com/selenium-webdriver/download-and-install-java/
Hope it helps!

List jUnit Tests That Were Run

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?

Categories

Resources