Hello, community! I see three options - Stop on failure, Optional and Continue on failure. I need a fourth option, something like - end the test as “completed” or “passed”.
I will describe in detail with an example.
I have 4 pages with clients.
There are 10 clients on each page.
4x10=40 clients on 4 pages.
I suddenly have a 41st client on the fifth page.
So, there are two problems:
- My script is written in such a way that it considers 10 pages and 10 customers on each page. In the described situation, I get the fifth page opened and the first client clicked to write him an email, but then the script clicks the second client on the same fifth page to write him an email.
But I have 41 clients, not 42. So the test case ends up failing. But I don’t need the failure because the list of customers is growing in the future. I put STOP ON FAILURE so it doesn’t go on continuing all the steps up to page 10, but that’s not the best solution. I get the result I want, but in the form of an error, which will prevent me from analysing the real errors if there are any.
- Next, if I have exactly 40 clients, all of whom were processed by the script, the script opens the fifth page, which does not exist on the site. This site does not have 404 errors, so the link to the fifth page I get to the first page (but link in browser still shows as it’s page=5) and all clients are processed on the second round, until the total of 10 pages will not be processed. How do I deal with this?
I made a script like this:
def myList = []
WebUI.navigateToUrl('...page=1...')
WebUI.click('findTestObject...Client (1)'), FailureHandling.STOP_ON_FAILURE)
myList << WebUI.getUrl()
println(myList)
/// Pages 2...3...4....
WebUI.navigateToUrl('...page=5...')
WebUI.click('findTestObject...Client (1)'), FailureHandling.STOP_ON_FAILURE)
if (WebUI.getUrl() in myList) {
println (Test Passed) (FailureHandling.STOP_ON_FAILURE)
} else {
WebUI.callTestCase(findTestCase('Branches/Favourites 2'), [:], FailureHandling.CONTINUE_ON_FAILURE)
}
WebUI.navigateToUrl('...page=5...')
WebUI.click('findTestObject...client (2)'), FailureHandling.STOP_ON_FAILURE)
In this example, the first client on the first page is added to the list. If the script hits the first page a second time (instead of the fifth page, which does not exist) and selects the first client that has already been processed previously, execution stops. (BUT WITH FAILURE).
If there are no 10 clients on the page, the script selects the ones that exist and then stops with an error. (BUT WITH FAILURE)
I don’t know any other way to stop execution. Everything is done successfully, but I don’t need to continue all the steps further if there are no more clients on the pages. And there are more pages on purpose, because profiles are different and one profile may have 20 clients, another 40, another 80 and so on.
Any ideas?