sheets. That column Is reserved to report the software test data execution results like “PASS“, “FAIL” or “SKIP“. If you look at our test cases, We have not Introduced webdriver In our software test suites but we will Implement It very soon.
Read more tutorials on selenium WebDriver @Tutorials Part 1 and @Tutorials Part 2.
Extract the folder and copy-paste folder’s files In “WDDF” project In Eclipse to replace existing files as described bellow.
- Paste SuiteOneCaseOne.java File on com.stta.SuiteOne Package.
- Paste SuiteOneCaseTwo.java File on com.stta.SuiteOne Package.
- Paste SuiteTwoCaseOne.java File on com.stta.SuiteTwo Package.
- Paste SuiteTwoCaseTwo.java File on com.stta.SuiteTwo Package.
- Paste SuiteOne.xls File on com.stta.ExcelFiles Package.
- Paste SuiteTwo.xls File on com.stta.ExcelFiles Package.
Note : Close all excel files before running your test suite. Otherwise you will get an error during your test suite execution.
Now Run your test suites from testng.xml file. On completion of test execution, Open SuiteOne.xls and SuiteTwo.xls files from com.stta.ExcelFiles Package. You will see that all the data set line’s “Pass/Fail/Skip” column Is updated with “PASS” or “FAIL” or “SKIP” as shown In bellow given Image.
- If result Is “PASS” : Means expected and actual values are match.
- If result Is “FAIL” : Means expected and actual values are not match.
- If result Is “SKIP” : Means “DataToRun” flag Is set to “n” so that test data set execution has been skipped.
22 thoughts on “Framework For selenium WebDriver – Report Test Data Result In Excel”
Thank you for the useful blog. I have encountered a couple of issues:
1. In SuiteOne.xls sheet TestCasesList pass/fail/skip is not populated even if all tests pass.
2. If test is configured to skip an entire test suite, the method which uses the data provider (e.g. SuiteTwoCaseTwoTest) is marked with a null pointer exception because parameters FilePath, TestCaseName are null. I think this is an issue with how TestNG handles data providers.
1. Test case list status update Is pending and you will get It In next or next to next post.
2. I am not see any null pointer exception. Can you please tell me the exact configuration?
For 1. In file TestSuiteList.xls set SuiteToRun to Y for SuiteOne and N for SuiteTwo. Then execute by running testng.xml through Eclipse. When viewing index.html or "Results of running suite" entries for SuiteTwoCaseOneTest and SuiteTwoCaseTwoTest, the error message is
SuiteTwoCaseOneTest java.lang.RuntimeException: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at com.stta.Utility.SuiteUtility.GetTestDataUtility(SuiteUtility.java:30)
at com.stta.SuiteTwo.SuiteTwoCaseOne.SuiteTwoCaseOneData(SuiteTwoCaseOne.java:99)
… 21 more
… Removed 28 stack frames
Thank you.
This comment has been removed by the author.
I am also getting nullpointer exception.
Detail TestNG stack trace is-
java.lang.NullPointerException
at com.stta.SuiteOne.SuiteOneCaseOne.SuiteOneCaseOneTest(SuiteOneCaseOne.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1220)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Note- i have followed all steps (1-15) as mentioned. It was working fine upto Step-14.Once i pasted the .java files mentioned in Step-15 folder,i am getting the issue.
Can you pls help me out?
Regards
Abhisek
I am trying to find out some solution for this. Let we Ignore It at this stage because It Is not affecting anyway to our test execution and reports.
Let us Ignore It right now because It Is not affecting anyway to our test execution and reports.
hi
how to use Constant to replace "Pass/Fail/Skip" column like
public static final String KEYWORD_PASS = "PASS";
public static final int COL_TEST_CASE_RESULT = 10;
so it will become
SuiteUtility.WriteResultUtility(FilePath_TestResult, TestCaseName, Constant.COL_TEST_CASE_RESULT, DataSet+1, Constant.KEYWORD_PASS);
Hi, in apache POI HSSF
how to set cell color Pass = green, Fail = red?
This helps you to generate reports in Excel
Hope this is fixed now. May be in next steps?
Hi, Mr. Acavind,
I'm good till now. just want let you know I think you are a great guy in the world.
Mak
can you upload new code with current API
all of excel getting corrept just running project
nothing running in your project at this stage with all current API.
Please follow steps properly as many people are able to implement it successfully. Read latest comment(31 May 2016) given by "JMan" on this page -> http://www.software-testing-tutorials-automation.com/2014/09/capture-screenshot-on-failure-or-pass.html?showComment=1464686583939#c8210083461956219711
i am using XSSF for excel sheet
I use data type String not integer when running results always "failed" in excel
it works when i run the test individually and then i run through testng xml. Even then, it doesn't work for other test cases until i run them individually.
Hi Arvind,
I just tried step#15 and I am still facing same issue which was reported earlier. I
am not seeing the test results in the excel file with pass/fail status.
Thanks
Prashant
Hi Arvind,
I just tried step#15 but I don't see Pass/Fail results in excel sheet.
Thanks
Prashant
How can we report all sheet results in one sheet instead of each sheet for each test case.