Quality Testing

Quality is delighting customers

How to add test case status (Pass / Fail) in result excel file using Selenium WebDriver?

Hi All,

I need a script for following scenario:

- I have a test cases excel file(testcases.xlsx) in sheet1

- I need to copy entire test cases in different excel file (result.xlsx) in sheet1

- Now add test case status Pass / Fail in result.xlsx file

How to do that? If possible can you please share a script?



Views: 1384

Reply to This

Replies to This Discussion

Hello Madhavi,

Yes, it is possible to write test cases in XLS files and also to store their pass/fail results into the "Result/Status" field in the same sheet or a different sheet. For this, you need to use TestNG (basically its annotation features) along with the Selenium Webdriver.

Here is a full-fledged example demonstrating how to use selenium to run test cases from XLS file and save their results.


Hi Meenakshi,

Thanks for sharing your blog. It is very helpful to me.

My test case scenario is: ---

- I have a test cases excel file(testcases.xlsx) in sheet1

From test cases sheet, I need to access test data aswell.

Once test case got executed, I need to create new file (Results.xlsx) in sheet1 and add test case actual result and test case status 

For example:

Test Cases sheet: (testcases.xlsx)

Result file: (Results.xlsx)

Can any one answer to this question....

Hi Meenakshi, 

Can you please reply to this question?


This is regarding your blog:

Your class name " SaveTestNGResultsToExcel class " having multiple @Test annotations, so you can able to write each testcase result you are able to write in SaveTestNGResultToExcel.xls

Say for example, if the Package (login) having 10 test cases (10 java classes)

How to write each test case java class in result in SaveTestNGResultToExcel.xls file?


TTWT Magazine





© 2022   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service