How to extract the test status (Pass/Fail) of a test_case/test_suite into a variable.

Hi there

This is my scenario:

When I execute a test case or test suit, I would like to get the test status (pass/Fail) and save it to a global variable. I would then send a REST call that will update my test status on crossbrowsertesting.com .

I use crossbrowsertesting.com as my browser and device hub.

crossbrowsertesting.com stores the test results but at the moment my test does not show pass or fail.

Is this possible or is there an alternative solution that would help me?

Thank you.

Comments

  • Hi

    Please search for this question on the forum "How to use tearDownIfPassed and tearDownIfFailed" This helped me.

    @TearDownIfPassed

    def handlePassed() {

        println('Handle Passed')

     

    WebUI.closeBrowser()
        GlobalVariable.CBT_pass_fail_status = 'pass'
        WebUI.callTestCase(findTestCase('Get Selenium ID from CBT'), [:], FailureHandling.STOP_ON_FAILURE)
        WebUI.callTestCase(findTestCase('Set test score on CBT'), [:], FailureHandling.STOP_ON_FAILURE)

    }
    @TearDownIfFailed

    def handleFailure() {

        println('Handle Failure')

     

    WebUI.closeBrowser()
        GlobalVariable.CBT_pass_fail_status = 'fail'
        WebUI.callTestCase(findTestCase('Get Selenium ID from CBT'), [:], FailureHandling.STOP_ON_FAILURE)
        WebUI.callTestCase(findTestCase('Set test score on CBT'), [:], FailureHandling.STOP_ON_FAILURE)

    }
    @TearDown

    def handleTearDown() {

        println('Handle TearDown')

    }
  • Hi,

    The above Scenario would help me a lot waiting for your reply katalon team make it ASAP.

    Thank You.

     
Sign In or Register to comment.