I have made a minimalistic example of modularized Test Case script using callTestCase keyword.
Test Cases/TC
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser('')
WebUI.setViewPortSize(800,600)
String title = ""
title = WebUI.callTestCase(findTestCase("sub/demoaut.katalon.com"), ["greeting": "Hello!"])
WebUI.comment("${title}")
//title = WebUI.callTestCase(findTestCase("sub/www.google.com"), ["greeting": "How are you?"])
//WebUI.comment("${title}")
title = WebUI.callTestCase(findTestCase("sub/duckduckgo.com"), ["greeting": "Goodbye!"])
WebUI.comment("${title}")
WebUI.closeBrowser()
Teset Case/sub/demoaut.katalon.com
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.comment("${greeting}")
WebUI.navigateToUrl("http://demoaut.katalon.com")
WebUI.waitForPageLoad(10)
// do anything you want
WebUI.takeFullPageScreenshot("./out/demoaut.katalon.com.png")
return WebUI.getWindowTitle()
Test Cases/sub/www.google.com
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.comment("${greeting}")
WebUI.navigateToUrl("https://www.google.com")
WebUI.waitForPageLoad(10)
// do anything you want
WebUI.takeFullPageScreenshot("./out/www.google.com.png")
return WebUI.getWindowTitle()
Test Cases/sub/duckduckgo.com
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.comment("${greeting}")
WebUI.navigateToUrl("https://duckduckgo.com/?q=duckduckgo&atb=v314-1&ia=web")
WebUI.waitForPageLoad(10)
// do anything you want
WebUI.takeFullPageScreenshot("./out/duckduckgo.com.png")
return WebUI.getWindowTitle()
Log when âTest Case/TCâ ran
The sub test cases can do anything
Test cases/sub/demoaut.katalon.com
and other test cases can do anything you want. It can do hundreds of lines of data manipulation. To demonstrate the potential, the demo script just takes a screenshot of the page, as this:
How to re-run partially
Please find in the âTest Cases/TCâ, a call to âTest Cases/sub/www.google.comâ was commented out
...
//title = WebUI.callTestCase(findTestCase("sub/www.google.com"), ["greeting": "How are you?"])
//WebUI.comment("${title}")
...
You can easily edit the code so that the TC processes the Google next time. Also you can easily edit the code so that the TC comment out other URL (duckduckgo.com) next time.
Test Cases/TC_www.google.com
You can create one more test case
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser('')
WebUI.setViewPortSize(800,600)
String title = ""
title = WebUI.callTestCase(findTestCase("sub/www.google.com"), ["greeting": "How are you?"])
WebUI.comment("${title}")
WebUI.closeBrowser()
This test case is self-contained. You can run it independently of others.
@mqamar
Are you a âManual viewâ user? Can you use âScript viewâ? The idea of mine above requires you to work with Script mode. It requires seasoned programming skill. If you can only use the Manual mode, then my idea above would not be practical for you. Just forget it.