Ask a Question

testRunner.testCase.getTestStepByName("my").setPropertyValue("id","42") not working in script ...

SOLVED
cc
New Contributor

testRunner.testCase.getTestStepByName("my").setPropertyValue("id","42") not working in script ...

Hello,

 

I tried to write a groovy script an to set values of a testrequest, and to excecute that afterwards. It looks like this:

 

testRunner.testCase.getTestStepByName("my").setPropertyValue("id", "42")
def whatis = testRunner.testCase.getTestStepByName("my").getPropertyValue( "id" )
log.info "Value of id by testRunner.testCase.getPropertyValue: "+whatis

testRunner.runTestStepByName("my")

 

The result in the log gives Value of id by testRunner.testCase.getPropertyValue: null

where I expected it to be 42, so also running "my" is not possible since it has no property values

 

Where is the problem? I don`t see where and what is going wrong?

Thanks,

 

P.S.

"my" looks like this:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ilUserAdministration">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:addGroup soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <id xsi:type="xsd:string">?</id>
      </urn:addGroup>
   </soapenv:Body>
</soapenv:Envelope>

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaulMS
Super Contributor

Re: testRunner.testCase.getTestStepByName("my").setPropertyValue("id","42&a

<id> is not defined as a property of the test step but it is included within the request property.

 

You can create a custom property at the test case level

testRunner.testCase.setPropertyValue("id", "42")

 

then to use the property in the request

<id xsi:type="xsd:string">${#TestCase#id}</id>

 

https://www.soapui.org/functional-testing/properties/working-with-properties.html

View solution in original post

3 REPLIES 3
cc
New Contributor

Re: testRunner.testCase.getTestStepByName("my").setPropertyValue("id","42&q

When I use Run TestCase instead of a SOAP Request it is possible to transfer data, but then again if Run TestCase is excecuted it doesn't provide the data for the SOAP Request, that I thought would be used there, instead it runs it without any data...

I'm getting confused here ..

Is there a place where this I think still basic part is explained?

PaulMS
Super Contributor

Re: testRunner.testCase.getTestStepByName("my").setPropertyValue("id","42&a

<id> is not defined as a property of the test step but it is included within the request property.

 

You can create a custom property at the test case level

testRunner.testCase.setPropertyValue("id", "42")

 

then to use the property in the request

<id xsi:type="xsd:string">${#TestCase#id}</id>

 

https://www.soapui.org/functional-testing/properties/working-with-properties.html

View solution in original post

cc
New Contributor

Re: testRunner.testCase.getTestStepByName("my").setPropertyValue("id","42&a

That is it exactly!

Thank you very much

 

cancel
Showing results for 
Search instead for 
Did you mean: