Prevent browser from closing after every test from test suit

I have test suit which contains only one test case but I am using multiple data from data files.

The issue I have is that everytime test case finish with one data browser close and open again for another test data.

Is there a way to leave the browser open for all test data and browser would close once all test data have been tested.

Any suggestion would be helpful.
Thanks

Create one Test Case that opens a browser, then calls a second test case and then closes the browser after the second test case completes…

In the second test case, create a loop that retrieves data from an Excel worksheet and performs a repeatable set of steps for each of the rows in the Excel worksheet that you would like to cycle through without closing the browser…

1 Like

Thanks David,

I have tried just putting loop within same test case but leave open and close browser outside of loop and it worked.

2 Likes

You can also uncheck Terminate drivers after each Test Case under Project-Settings-Execution-Default.

1 Like

Thanks Susan,

I have tried initially when I wanted to try this but it did not work for me.
I am using katalon on Mac.

It sounds like you need a data drive test suite, which isn’t actually available, but can be done using what David describes. You have a Test Case that opens the browser, then calls all the other Test Cases you need, then closes out. It would be a series of:

WebUI.callTestCase(findTestCase('Test Cases/Test Case Location/Test Case Name'), [:], FailureHandling.CONTINUE_ON_FAILURE

Please how did you achieve this?

hey sir please how can i let this code in this test case that repeat everytime it finish with getting data from exel file ?

WebUI.click(findTestObject(‘Object Repository/Search_repo/Page_Page de dmarrage/a_Contrats de client’))

WebUI.click(findTestObject(‘Object Repository/Search_repo/Page_Page de dmarrage/a_Rechercher un contrat’))

WebUI.setText(findTestObject(‘Object Repository/Search_repo/Page_Rechercher un contrat/input_Code contrat_CO_ID_PUB’), cocode)

WebUI.click(findTestObject(‘Object Repository/Search_repo/Page_Rechercher un contrat/input_Cl publique_SuSubmitButton’))

WebUI.click(findTestObject(‘Object Repository/Search_repo/Page_Rechercher un contrat/a_CONTR0005980788’))

The easiest way is to add a TestListener, in the left bar, which executes an action before each testCase, example:
@BeforeTestSuite
def open Browser () {
WebUI.openBrowser (‘http://yourpage.com’)
}

Note: you must remove the function from the testCase because the TestListener will open the browser before each testCase