Read from an excel file

Hello, I’m looking for a way to read from an excel file and store the data in an object so I can use the object in multiple test case at the same time. Creating local variables in each test case isn’t helpful because sometimes I use to same data in other test cases so I won’t create same local variables in each test cases (bad practice). What I’m looking for is to run a test suite that contains multiple test cases and execute them many times based on excel file data rows.

@kazurayam You are the only one who can help me here

Are you aware that a TestCase script can call other TestCases passing parameters from the caller to the callee.

Let’ me assume your “Controller” test case read Excel file to get variable values and hold it.
The Controller calls other “Worker” test cases passing the values to them as parameter.

How do you think about this approach? Is it applicable to your case? Does it help? If not, please describe why “Call Test Case” does not help.

Thank you man for to the solution but no I don’t prefer to use call test case because I want to keep test cases independent, if there is an alternative solution it will be better

Do you want to read an excel file into a variable in a TestCase script? Then see

Thank you for posting these, but this method won’t let me run the test cases multiple time with different rows data

You want read rows from a Excel sheet and run multiple test cases passing data as parameter to the callee? Then how about this?

testData.getAllData().stream().forEach(entry -> { // Each entry is also a List 
    WebUI.callTestCase(findTestCase("yourTestCase1"), ["params": entry])
    WebUI.callTestCase(findTestCase("yourTestCase2"), ["params": entry])
    WebUI.callTestCase(findTestCase("yourTestCase3"), ["params": entry])
});