I have scenario and looking for ideas and code snippet to achive the same

how to achieve this scenario in katalon

  1. Create test case for opening two browsers simultaneously.
  2. Create another test case for login to two different URL in above browsers
  3. Create another test case for Logout from each application
  4. Create a Test Suite combining above 3 TCs
  5. Create a Test Suite Collection and add the above test suite created above and run it with different browser, Example, add the same test suite 3 three times one with Chrome, One with Firebox and another with Chrome Headless browser
2 Likes

1. Create test case 1 for opening two browsers simultaneously.

String driverpath = System.getProperty(‘user.dir’) + ‘\WebDriver\chromedriver.exe’
System.setProperty(‘webdriver.chrome.driver’, driverpath)
//open browser1
WebDriver browser1 = new ChromeDriver()
browser1.manage().window().maximize()
//open browser2
WebDriver browser2 = new ChromeDriver()
browser2.manage().window().maximize()

  1. Create another test case for login to two different URLs in the above browsers

browser1.get(GlobalVariable.appUrl)
DriverFactory.changeWebDriver(browser1)

your login code here for 1st browser
you can use the Katalon Keywords here
eg:
WebUi.click()
etc…

browser2.get(GlobalVariable.appUrl)
DriverFactory.changeWebDriver(browser2)

your login code here for 2nd browser
you can use the Katalon Keywords here
eg:
WebUi.click()
etc…

  1. Create another test case for Logout from each application

DriverFactory.changeWebDriver(browser1)

your logout script here for 1st browser
you can use the Katalon Keywords here
eg:
WebUi.click()
etc…

DriverFactory.changeWebDriver(browser2)

your logout script here for 2nd browser
you can use the Katalon Keywords here
eg:
WebUi.click()
etc…

browser1.close()
browser2.close()

  1. create a new test case and call all the 3 test cases into a single case
  2. create a test suite for the 4 th case
  3. add the suite 3 times and create a testsuite collection

Hi @bharathi.a , The above works only for Chrome browser. As we have feature in Test Suite collection to choose the browser type at runtime, I am looking at possible way to make use of it in above scenario instead of user defined driver.

Thanks for the suggestion.

1 Like

You want to know the way how to detect why which type of browser you (your Test Case Collection) chose at runtime.

The following snippet shows it:

import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.driver.WebUIDriverType

WebUIDriverType dtype = DriverFactory.getExecutedBrowser()
println dtype    // "Chrome", "Firefox", "Edge Chromium", "Chrome (headless)"
1 Like

I think you have to make a copy of the script 3 times and declare the browser manually in the scripts