Forum Discussion

Wives's avatar
Wives
Occasional Contributor
7 years ago
Solved

Transferring a property within a "Run TestCase" step is successful but is not stored anywhere?

I've looked around the forums for similar issues but none of the answers seem to explain this exact case:

 

I have a TestCase "Mom" that has a TestStep that is a Run TestCase "Son".

The original testcase for Son contains a Property Transfer that sources data from a response and targets a property "Number" in the TestCase.

 

When I run Mom and Son triggers, I can see that the property transfer is logged as successful. However, the Number property within that Run TestCase step is still empty.

 

Q: How can I get the property transfer within the Run TestCase step to store the data?

 

If I run the original testcase for Son, the transfer indeed does store the data in the property within the testcase.

 

 

 

Thanks in advance!

 

  • If the Son test case sets the property at the Son test case level, it's not going to set it at the Mom test case level no matter how you kick it off. You would need to write a groovy script, potentially, to transfer that property manually. You can put this as a groovy script test at the end of Mom test case, after the run Test case level.

     

     

    // set Target test case.
    def mom = context.testCase;
    
    // set Source test case;
    def son = context.testCase.testSuite.testCases["Son"];
    
    // transfer the property
    
    mom.setPropertyValue("PropertyName", son.getPropertyValue("PropertyName"));

12 Replies

  • groovyguy's avatar
    groovyguy
    Champion Level 1

    Are you trying to access that property within the MOM test case or the SON test case?

    • Wives's avatar
      Wives
      Occasional Contributor

      Hello,

       

      I am trying to access the property from the MOM testcase.

       

      • nmrao's avatar
        nmrao
        Champion Level 3

        But was it being set in Son TestCase?