Ask a Question

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

SOLVED
Wives
Occasional Contributor

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.

 

Transfer did not transfer.png

 

 

Thanks in advance!

 

1 ACCEPTED SOLUTION

Accepted Solutions
msiadak
Community Hero

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

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"));



---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

View solution in original post

12 REPLIES 12
msiadak
Community Hero

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

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




---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
Wives
Occasional Contributor

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

Hello,

 

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

 

nmrao
Community Hero

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

But was it being set in Son TestCase?



Regards,
Rao.
nmrao
Community Hero

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

Are both Mom & Son in the same test suite? or in different suites?


Regards,
Rao.
Wives
Occasional Contributor

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

Yes it was.

 

So the structure looks like this...

 

Son Test Case:

- Request1 : Response contains value1

- Property xfer value1 : source = value1 from response above, target = Son Test Case (in property = prop1)

-Request2

 

Mom Test Case:

- Run Son Test Case

 

So I'm wondering why when Mom triggers Son as a step here, why is Mom's property prop1 not populated with value1?

Wouldn't the property transfer within the step "Run Son Test Case" store its value1 into the Test Case property (which would be Mom)?

 

If there's a better way I could explain this, please let me know 🙂

Wives
Occasional Contributor

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a


@nmrao wrote:
Are both Mom & Son in the same test suite? or in different suites?

And yes, they are in the same test suite.

The reason why I am not transferring them to the suite level is because I have multiple tests that would require this kind of transfer and I would like to keep them separate.

nmrao
Community Hero

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

@Wives,

 

Earlier, I too had this kind of issue, I guess. See here.

 

I thought it would be easy to explain things in a better way if user can try it and experience it. Your question inspired me to create the below project.

Hence, I have created a sample project. Please see if that is helpful.

https://github.com/nmrao/sample-soapui-projects/tree/master/run-test-case



Regards,
Rao.
msiadak
Community Hero

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a

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"));



---

Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!

View solution in original post

Wives
Occasional Contributor

Re: Transferring a property within a "Run TestCase" step is successful but is not stored a


@msiadak wrote:

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"));

This is functionally equivalent to putting in a property transfer step afterwards, correct?

I currently have a similar step as a workaround but I think you two have answered the question:
Property Transfers within Run TestCase steps cannot transfer to the Test Case using it. An additional transfer script/step must be inserted after the Run TestCase or the transfer must target the Test Suite level (given they share the same suite).

 

Thanks @msiadak and @nmrao for your help, what a fantastic community.

cancel
Showing results for 
Search instead for 
Did you mean: