Forum Discussion

tranld's avatar
tranld
Visitor
9 years ago

testcase log is only correct the first time after opening SoapUI

I am trying to enhance my testcase log with the parameter's name for readability, but I find that the log only shows the correct info the first time SoapUI (open source version) is launched.  All subsequent runs (without changing anything) are incorrect.   The test ran correctly each time though.  Below is my test case.  As shown from the results, the first time it is run, the logs are correct.  For all subsequent runs, the logs are incorrect, even though it was run correctly.  How can I write it so the log record the testname+parameter as it is run?

 

Best Regards,

 

test case consists of 3 steps:

-testRunner.gotoStep(2) (groovy script)

-Create Noc (this rest API takes a parameter ["NocId" : ${NocID}] which is set from next groovy step)

-SetNetNoc (groovy script)

for (id = 1; id < 4; id++) {

    context.setProperty("NocID", String.valueOf(id))

    testName = "Create NocID=" + String.valueOf(id)

    //Rename test step to include NocID for readability in the log

    curTC = testRunner.testCase curTC.getTestStepAt(1).setName(testName)

    log.info(testName) testRunner.runTestStepByName(testName)

}

 

test case tear downscript:

//rename test step to generic name

context.setProperty("NocID", "0")

curTC = testRunner.testCase curTC.getTestStepAt(1).setName("Create NocID")

 

 

-----Results from 1st run----------------

Test started at 2016-05-23 11:10:01.343

Step 1 [Groovy Script] OK: took 375 ms

Step 2 [Create NocID=1] FAILED: took 3121 ms        <-----------as expected

-> [Contains] Missing token ["[0-9]*"] in Response

Step 3 [Create NocID=2] OK: took 2226 ms                <-----------as expected

Step 4 [Create NocID=3] OK: took 2662 ms                <-----------as expected

Step 5 [SetNextNoc] OK: took 18159 ms

TestCase failed [Failing due to failed test step], time taken = 26543

-----Results from 2nd run----------------

Test started at 2016-05-23 11:13:25.549

Step 1 [Groovy Script] OK: took 0 ms

Step 2 [Create NocID=2] FAILED: took 2212 ms       <------------should be "[Create NocID=1]"

-> [Contains] Missing token ["[0-9]*"] in Response

Step 3 [Create NocID=2] OK: took 2228 ms               <------------should be "[Create NocID=2]"

Step 4 [Create NocID] OK: took 1982 ms                   <------------should be "[Create NocID=3]"

TestCase failed [Failing due to failed test step], time taken = 22855

Step 5 [SetNextNoc] OK: took 16433 ms

No RepliesBe the first to reply