Forum Discussion

Mdar's avatar
Mdar
Occasional Contributor
3 years ago
Solved

Behavior when a test step fails

I have a collection of test cases, each with several groovy-script test steps. When a test-step fails, the method testrunner.fail() is called. This has the effect of ending that current test step, and not running all subsequent test steps in that test case -- is that the intended behavior?  

 

Question: Is it possible to have the subsequent test steps still run? Or if I want that behavior, is it better to separate the logic into a discrete test case?   

 

All the best,

 

-Mdar

 

  • Mdar,

    The default behavior is to stop the test case execution if a test step fails.

     

    But, you can change it in TestCase properties if you prefer to continue (see picture below).

     

     

    Inside the groovy script, you can use an assertion, e.g.:

     

    assert true == false: "Test step failed"

     

    Then the following test steps are executed. However, if you use:

     

    testRunner.fail("Hi there")

    The execution stops regardless of your TestCase setup described above.

     

    Best regards,

    Karel

     

2 Replies

  • KarelHusa's avatar
    KarelHusa
    Champion Level 2

    Mdar,

    The default behavior is to stop the test case execution if a test step fails.

     

    But, you can change it in TestCase properties if you prefer to continue (see picture below).

     

     

    Inside the groovy script, you can use an assertion, e.g.:

     

    assert true == false: "Test step failed"

     

    Then the following test steps are executed. However, if you use:

     

    testRunner.fail("Hi there")

    The execution stops regardless of your TestCase setup described above.

     

    Best regards,

    Karel