Hey there,
im trying to find a smart way to handle a login testcase as part of a bigger test-suite with minimal code-duplication.
Issue: all my test-cases require a login at the start, so instead of doing that in every single test-case i do this in the test-suite script with
@SetupTestCase(skipped = false) // Please change skipped to be false to activate this method.def setupTestCase() {WebUI.navigateToUrl('redactedURL.com') //LoginCustomKeywords.'test.key.login'('timo.becker@capitol.test', '123456')
Now i have a login validation test-case which looks something like this and should not execute the login as part of the setup
//Login with no DataCustomKeywords.'test.key.login'('', '')WebUI.verifyElementPresent(findTestObject('General/text_form_error'), 1)//Login with invalid EmailCustomKeywords.'test.key.login'('timo.becker@capitol', '123456')WebUI.verifyElementPresent(findTestObject('General/text_form_error'), 1)//Login with invalid PasswordCustomKeywords.'test.key.login'('timo.becker@capitol-versicherung.test', '654321')WebUI.verifyElementPresent(findTestObject('General/text_form_error'), 1)//Login with deactivated UserCustomKeywords.'test.key.login'('ulf.steinke@test.test', '123456')WebUI.verifyElementPresent(findTestObject('General/text_form_error'), 1)//Login with valid DataCustomKeywords.'test.key.login'('timo.becker@capitol-versicherung.test', '123456')WebUI.verifyElementNotPresent(findTestObject('General/text_form_error'), 1)WS.sendRequestAndVerify(findTestObject('api/login'))
What would be a smart way to approach this?