Forum Discussion

krogold's avatar
krogold
Regular Contributor
6 years ago
Solved

testcase called by groovy script : missing custom property content

Hello,

I encounter a strange issue with readyAPI 2.6.0

I regularly use groovy scripts in which I call other testCases, I use the same principle each time :

    def jsonSlurper = new groovy.json.JsonSlurper()
    def TC;
    def async = false

    testSuite = "target_testSuite"

    tc_name = "target_name"
    TC = testRunner.testCase.testSuite.project.getTestSuiteByName(testSuite).getTestCaseByName(tc_name)
    TC.setPropertyValue("UID", uid)
    result = TC.run (context.getProperties(), async) 

    response = result.getTestCase().getTestStepByName("Request 1").testRequest.response.getResponseContent()
    jSonResponse = jsonSlurper.parseText(response)  

    if (String.valueOf( result.status ) != "PASS")
    {
        msg = "unexpected failure during $tc_name processing on $uid : $jSonResponse"
        testRunner.fail(msg)
    }
    else
    {
        // process result
    }

which always work but I have a case where the property set with TC.setPropertyValue("UID", uid) remains empty. I tried to remove the property in the target testCase and it is created (so it works), though without any value.

I don't have a clue of what's happening. the testCase options are the same as the other test cases I use.

 

Has anyone any idea ?

it is very frustrating  :(

 

thanks

 

Alex

  • OK, finaly I found out what happened, a reference was lost in the called test case, probably a wrong update

    sorry for disturbing

     

    Alex

2 Replies

  • krogold's avatar
    krogold
    Regular Contributor

    OK, finaly I found out what happened, a reference was lost in the called test case, probably a wrong update

    sorry for disturbing

     

    Alex

    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Hi Alex,

      Thanks for sharing the solution with us. I'm sure it will help someone in the future.