Decision-making Statements
Note:
Once a test step is added as any of the control statements, it is not allowed to change into another keyword.
In manual view
In script view
The Script view of test cases allows you to programmatically define and handle If-ElseIf-Else or Switch-Case structure using Groovy or Java language. For more details about the conditional structure in Groovy, refer to this Groovy documentation: Control structures.
For example:
If - Else If - Else :
if (true) { WebUI.click(findTestObject('Page_CuraAppointment/chk_Medicaid'), FailureHandling.STOP_ON_FAILURE) } else if (true) { WebUI.click(findTestObject('Page_CuraAppointment/chk_Medicare'), FailureHandling.STOP_ON_FAILURE) } else { WebUI.click(findTestObject('Page_CuraAppointment/chk_None'), FailureHandling.STOP_ON_FAILURE) }
Switch - Case :
switch (true) { case true: WebUI.click(findTestObject('Page_CuraAppointment/chk_Medicaid'), FailureHandling.STOP_ON_FAILURE) break case true: WebUI.click(findTestObject('Page_CuraAppointment/chk_Medicare'), FailureHandling.STOP_ON_FAILURE) break default: WebUI.click(findTestObject('Page_CuraAppointment/chk_None'), FailureHandling.STOP_ON_FAILURE) break }