Ask a Question

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

SOLVED
nmrao
Community Hero

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

@Wives,
Not sure if you look at the project that I provided. It was done that way you were taking, I belive. But done using groovy script.


Regards,
Rao.
msiadak
Community Hero

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

@Wives: You are correct. Using a "Run Test Case" step will not cause anything to transfer natively. It just runs a test case as if you ran it manually. So either you need another Property Transfer, or you need the groovy script, which it looks like you figured out.

 

One caveat is that, if you need to transfer properties across Test Suites, I believe a Property Transfer step can only handle moving within test cases in the same suite. If you have to cross Test Suites, then you have to use something similar to the groovy script(s) provided. 🙂 




---

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

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

I am not sure whether this would always work. As long as I understand, this would work if the SON test case would run in primary mode. But when using isolated mode (i.e. a copy of the test case is being run), the properties are being transferred to the SON test case copy, but they do not overwrite the values in the primary test case, which are eventually being left unchanged and stay the same even after the "Run TestCase" test step finishes. I did not try it myself though.

However, there are other means of getting the result properties from the SON test case in any mode.
In the "Run TestCase" test step under options the user can specify, which properties should be extracted and returned (only properties already declared in the SON test case  are available, properties created in underlying groovy scripts need to be created in advance). After the SON test case finished, the selected properties will be copied to the scope of the test step (bot not to MOM test case scope). There is also an additional option to NOT copy empty properties, which can come in handy if you rather want to keep the previous property value in the test step scope instead of it being overwritten by an empty string.

Once the "Run TestCase" test step finishes and the properties from the SON test case are extracted to the test step scope, you can reference later them in a REST request, or when passing to another SON test case, etc., using

${Test Step Name#propertyName}

This works also in groovy using the context.expand function.

cancel
Showing results for 
Search instead for 
Did you mean: