Transferring a property within a "Run TestCase" step is successful but is not stored anywhere?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to access the property from the MOM testcase.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But was it being set in Son TestCase?
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Rao.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 🙂
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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.
