Delivered by FeedBurner

Selenium Automation Framework : Reporting Test Cases Results In Excel

Data driven software testing framework for selenium webdriver should be able to report the software test suite results In excel files. We have achieved goal of reporting test failure In testng reports In STEP 16. Now let us try to achieve our next goal of reporting software test cases's results In excel files.

Prerequisite : All the previous 16 steps of data driven framework creation should be Implemented. You will find the links for all previous steps on THIS PAGE.

How To Report Test Suite Pass
If you know, We are checking "CaseToRun" at beginning of every software test cases Inside @BeforeTest annotation method. So If we will find "CaseToRun" = "N" for specific test case then we will report It as "SKIP" In excel sheet Immediately.

We can set any test case as "FAIL" when any software test data set of that test case Is  "FAIL". We will set one flag on test data set failure and then use that flag Inside new created @AfterTest method to report that test case as "FAIL". If test case Is not "SKIP" and not "FAIL" then we will consider It as a "PASS" to report In excel sheet.

Download Updated Test Cases and Excel Files
I have updated all test cases and excel files as per requirement for testing purpose. You will get all of them by downloading bellow given zip folder.
Extract the downloaded folder and copy-paste files on "WDDF" project's packages as described bellow.
  • Paste File on com.stta.SuiteOne Package.
  • Paste File on com.stta.SuiteOne Package.
  • Paste File on com.stta.SuiteTwo Package.
  • Paste File on com.stta.SuiteTwo Package.
  • Paste SuiteOne.xls File on com.stta.ExcelFiles Package.
  • Paste SuiteTwo.xls File on com.stta.ExcelFiles Package.
Run Test Suites To Report Test Suites Result In Excel
Now you can run your test suites to verify that test cases results are being updated properly or not In both test suite's excel files which are located Inside com.stta.ExcelFiles Package.

Run your test suites through testng.xml file. On completion of test execution, open the "SuiteOne.xls" and "SuiteTwo.xls" files and verify results In "TestCasesList" sheets. You will see results for all four software test cases as shown In bellow given Image.

In excel files,
  • SuiteOneCaseOne test case Is reported as "FAIL" because one of the test data Is "FAIL" for that test case.
  • SuiteTwoCaseOne test case Is reported as "SKIP" because "CaseToRun" flag Is "N" for this test case so test execution has been skipped.
  • SuiteOneCaseTwo and SuiteTwoCaseTwo test cases are reported as "PASS" because for both the test cases, One data line Is "SKIP" but other Is "PASS". So we will report It as "PASS".
  • SuiteTwoCaseOne test case Is Skipped from execution so test data set results In "SuiteTwoCaseOne" sheet will be not reported.
We have achieved our goal of reporting software test cases status In excel sheets In this step.

So now we are able to read test suite, test cases and test data from excel files and also we are able to report the status according to the results of different test cases, test data and test suites.


  1. When I changed testdata as "N" for 2nd data set, the result printed as "Pass".In the console result also same thing is happening. But the test data should be shown as "Fail". Can anybody say the solution? Also I'm not able to take screenshot?

  2. After executing the script, the result in the SuiteTwoCaseOne sheet is removed. Rest things are working fine.

    1. your are using HSSF or XSSF for excel sheet. because i am getting exception.
      can you share your full code on my mail id with jar files.