Tip: FORCESTOP

When developing lengthy Test Cases, it’s useful to be able to stop execution to examine the state of the browser. True, you could use the debugger, but many times it’s overkill and I don’t actually want to examine the test code.

For me, this little method does exactly what I want – it kills the test at the exact point I need and allows me to do something in the browser:

import com.kms.katalon.core.exception.StepErrorException as StepErrorException
...

public class mytools {

  static void FORCESTOP() {
    throw new StepErrorException("FORCEDSTOP")
  }
  ...
}

That method lives a keyword tools class which I import “everywhere”. Then, in a test case script I do this:

FORCESTOP()

Hope it helps you, too!

4 Likes

Thanks, Russ!

While developing a test, I usually use WebUI.acceptAlert() in a point where no alerts are expected. I think it serves the same purpose.

Thanks for your sharing. I’ve posted it here:
https://docs.katalon.com/display/KD/Force+stop+execution

Feel free to correct me if there is something wrong.

In the https://docs.katalon.com/display/KD/Force+stop+execution I found

I don’t actually want to …
For me, this little …

I, me — who is it? wondering, wondering …
Ah! I found “Credit to: who” statement at the bottom of the page.

Vinh,

If you keep I and me as written in the original text, then I think “Credit to: who” should be on the 1st line. Just to avoid a unsettled feeling “who is it?”.