Thank you, however it is not really validating the url and still the script is passing even when I intentionally provide wrong url. Here is what I have written.
import com.kms.katalon.core.exception.StepFailedException as StepFailedException
// ...
if(currentUrl != "whatever") {
throw new StepFailedException("Bad URL")
}
// rest of test
I apologize. It is still not working. Would you mind copy/paste the code? I appreciate for your help! All I need is to validate the page URL whether it is expected result or not .
Please share the latest version of your test case script, do not trim any lines such as import statements
Please enclose your code with triple back-ticks for code formatting:
Please share the definition of your Test Obect a_Mission Bio Launches Single-cell Multi-om_53ab2a (XPath expression or CSS Selector)
What do you want your code to do when it find the current URL is NOT identical to the URL you expect? What message do you want to see? Do you want the code to continue or stop further processing?
well yeah … agreed.
however, i mostly used katalon for API testing, so my mind works like:
check if response is 200 otherwise there is no point to go further
check if response is a valid json otherwise there is no point to go further
… and so on
most of the time i want to stop immediately the script if something went wrong.
if i need a custom message i can simply do:
assert fail_something_here : "test failed because i am lazy to write if/else"
if the testcase requires to catch a specific exception (could be the case for json schema validation where i may want to filter the displayed messages) i will rather go to write a custom keyword for it so if i have to pimp it further i will do in only one place, not in 100 if/else or try/catch spread across various testcases.
whatever is not treated by my keword i want to be thrown with full stack so i can further debug it.
so … as you are a firefox addicted, i am assert addicted. it just works for me