how can I generate the report after executing test cases in the selenium web driver. I am trying Test NG for generating report but I have to write different code to get the report?
If you use Maven with Surefire plugin (which I strongly recommend), report is always located in target/surefire-reports/index.html. If that is not enough for your than you can use ReportNG library which is supposed to have more convenient reports in HTML format.
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.
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."
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!
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?
Is it possible to programmatically, in java, convert Selenium HTML file to JUnit test source code?
I need my own program which gets only resources of these html files, converts them to java code and automatically runs the JUnit test. Is there any way to do that?
In Selenium IDE, it is possible to export test cases to JUnit, I know that, but I don't want to use IDE, I need to do this programmatically as I said once before.
I believe that someone needed this before and someone can help me...
How about http://code.google.com/p/selenium4j/ ??
How does Selenium4j work?
In short Selenium4j translates the HTML tests to Java JUnti tests.
UPDATE
Maven port of this project available through https://github.com/willwarren/selenium-maven-plugin:
<dependency>
<groupId>com.gbi.maven</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
Also it mirrored at warious MVN repos:
http://mojo.codehaus.org/selenium-maven-plugin/
There exists a Firefox plugin for the Selenium IDE called Test Suite Batch Converter which can convert batches of HTML files to any export format the IDE supports.
I took the selenium4j project and turned it into a maven plugin for those who want to take the html test cases and automatically have them run with your maven test phase. You can also separate the tests out using a profile override with surefire.
Readme is here: https://github.com/willwarren/selenium-maven-plugin
The short version of the readme:
Converts this folder structure:
./src/test/selenium
|-signin
|-TestLoginGoodPasswordSmoke.html
|-TestLoginBadPasswordSmoke.html
|-selenium4j.properties
Into
./src/test/java
|-signin
|-firefox
|-TestLoginGoodPasswordSmoke.java
|-TestLoginBadPasswordSmoke.java
This is only tested on windows with Firefox and Chrome.
I couldn't get the IE version to pass a test, but I'm new to selenium so hopefully, if you're a selenium guru, you can get past this.
Look at the selenese4J-maven-plugin. Similar to selenium4j (https://github.com/RaphC/selenese4j-maven-plugin).
Provides many features : Selenium 1/2 (WebDriver) conversion Test Suite generation Internationalisation of your html file Possibility to use snippet into your html file for specific test (e.g : computing working day, write custom generation of values, handle dynamic values ...) Use of tokenized properties