Last active
December 13, 2023 12:46
-
-
Save belajargitbinar/395621ad3bc0f2567ea10f857e07b2ed to your computer and use it in GitHub Desktop.
Test Hook Katalon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.kms.katalon.core.util.KeywordUtil | |
class Hook { | |
def openBrowser() { | |
WebUI.openBrowser(''); | |
WebUI.maximizeWindow(); | |
WebUI.navigateToUrl('https://www.saucedemo.com/'); | |
} | |
def closeBrowser() { | |
WebUI.closeBrowser(); | |
} | |
@BeforeTestCase | |
def beforeTestCase(TestCaseContext testCaseContext) { | |
KeywordUtil.logInfo('Test Case: ' + testCaseContext.getTestCaseId()) | |
this.openBrowser() | |
} | |
@AfterTestCase | |
def afterTestCase(TestCaseContext testCaseContext) { | |
KeywordUtil.logInfo('Test Case: ' + testCaseContext.getTestCaseId()) | |
this.closeBrowser() | |
} | |
@BeforeTestSuite | |
def beforeTestSuite(TestSuiteContext testSuiteContext) { | |
KeywordUtil.logInfo('Test Suite: ' + testSuiteContext.getTestSuiteId()) | |
this.openBrowser() | |
} | |
@AfterTestSuite | |
def afterTestSuite(TestSuiteContext testSuiteContext) { | |
KeywordUtil.logInfo('Test Suite: ' + testSuiteContext.getTestSuiteId()) | |
this.closeBrowser() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment