If we make a new test case and add two new test steps to it ,both groovy scripts and then in first groovy script we add the line
log.info "A starting";
log.info "B starting";
testRunner.cancel("Some reason for cancelling the test");
log.info "C starting";
Then if we go to the test case level and run both the test steps by pressing the green play button .Then we will see that for first test step (Groovy script 1) all lines will be executed but the second test step(Groovy script 2) with never be executed and test case will also show as cancelled.
Please note that for Groovy step 1 it will print everything i.e is even log.info "C starting"; even though it is after the cancel statement. So it will print all test steps in Script 1 1 but will not print any step in Script 2.
Same way we can type a command to fail a test step
testRunner.fail("Some reason for failing the test");
And when we run the test case it will show that whole test case failed and not cancelled and all statements in the next test step(Groovy script 2 ) will not execute.