Forum Discussion

Wanaka's avatar
Wanaka
Occasional Visitor
3 years ago

TestCaseA teardown runs 4 seconds after TestCaseB starts is this a bug?

Dear Smartbear / ReadyAPI users,

 

We are using ReadyAPI 3.6.0, we use Jenkins with testrunner to execute our testsuites. I am trying to understand if I have found a bug in ReadyAPI or if it is user error.

 

My scenario is I have a TestSuite with TestCase A and TestCase B. For Test A in the teardown tab with Groovy script I call two testcases (TestCaseX and TestCaseY) both are needed to reset my environment before TestCaseB executes. 

 

I have an intermittent issue, for a one of my builds, TestCase A finishes executing (as well as TestCase X from the teardown) , TestCase B  starts to execute then 4 seconds later  TestCase Y is executed from the teardown script of Test Case A. I was expecting the entire teardown script of Test Case A to finish executing before testrunner launches Test Case B. Is this a defect or something wrong in my teardown code?  Many thanks for your support and advice.

 

My Groovy code in TestCase A Teardown tab is below:

 

// get Reset Environment Test Suite X
def resetTestSuiteX= testRunner.testCase.testSuite.project.getTestSuiteByName("Reset Test Suite X")
// get Reset Environment Test Case X
def resetTestCaseX= resetTestSuiteX.getTestCaseByName("Reset Test Case X")
// set a property in context required to execute testcase A
context.setProperty("in.opt.filename","filename1.json")
// run the testCase Y passing the context
def contextMap = new StringToObjectMap( context )
resetTestCaseX.run(contextMap,true);

// get Reset Environment Test Suite Y
def resetTestSuiteY= testRunner.testCase.testSuite.project.getTestSuiteByName("Reset Test Suite Y")
// get Reset Test Case Y
def resetTestCaseY= resetTestSuiteY.getTestCaseByName("Reset Test Case Y")
// run the testCase Y passing the contextMap (but it ignores it as it doesn't need any property to run)
resetTestCaseY.run(contextMap,true);

 

 

 

 

 

 

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    Additional details might help for better understanding such as the list of test steps (and its type) in each test case.

     

  • sonya_m's avatar
    sonya_m
    SmartBear Alumni (Retired)

    Thanks, Rao!

     

    Hi Wanaka. Did you already solve this? If not, please provide the Community with additional info as Rao is asking.