I would like to use the methods tearDownIfFailed and tearDownIfPassed.
when a test completes, I would like to call these methods and check if either of them are true and save that to a variable. If true i would then send a REST call to update a status on another service.
Note: I have checked online documentation and I still do not understand. Please provide a coding example.
**This answer is in reference to my question above**
The code below is what i want to achieve in Katalon studio. This is an example in c# [TearDown] public void TearDown() { if (TestContext.CurrentContext.Result.Status == TestStatus.Failed) { // Your test failed, handle it } }
Does these annotations @TearDownIfPassed and @TearDownIfFailed works only in Test Case level ?
Looks like it do not work in Test suite .
If it works at Test suite level, it is required to keep only once in Test suite and then it should be applicable to all test cases in the suite.
I had this exact experience. These annotations do not kick off the corresponding method when this annotation and its method code is used in the Script tab of a Test Suite.
@duyluong Can you clarify further? Would your code work if it was placed in the Script tab of a Test Suite. In my experience, it didn’t work. A test would fail, but the annotation didn’t handle it at all.