Forum Discussion
JimL
14 years agoContributor
Hi,
I'm trying to implement what I described in the posts above.
What I've done so far is add a Groovy Script test step to a test case, so now, in the testcase I have:
- Groovy script test step
- A request
In the Groovy script test step, I've added the following code:
In the request, I have:
When I run the test case, I can see the new properties (dnstring and requestid) being populated form the text file, but it looks like that ${#Testcase#dnstring) property is not being populated.
Can anyone tell what I'm doing wrong?
Thanks,
Jim
I'm trying to implement what I described in the posts above.
What I've done so far is add a Groovy Script test step to a test case, so now, in the testcase I have:
- Groovy script test step
- A request
In the Groovy script test step, I've added the following code:
props = new java.util.Properties ()
file = new File("E:/SOAPUI-PROPS/testprops.txt")
if(!file.exists()) {
log.info "No file found at E:/SOAPUI-PROPS/testprops.txt"
}
else {
log.info "Found E:/SOAPUI-PROPS/testprops.txt"
fis = new FileInputStream (file)
props.load (fis)
requestid = props.getProperty ( "requestid" )
log.info "requestid = [" + requestid + "]"
dnstring = props.getProperty ( "dnstring" )
log.info "dnstring= [" + dnstring + "]"
testRunner.testCase.setPropertyValue("requestid", requestid);
log.info "Finished setting 'requestid' property"
testRunner.testCase.setPropertyValue("dnstring", dnstring);
log.info "Finished setting 'dnstring' property"
}
In the request, I have:
<saml:Subject xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"><saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">${#TestCase#dnstring}</saml:NameID>
</saml:Subject>
When I run the test case, I can see the new properties (dnstring and requestid) being populated form the text file, but it looks like that ${#Testcase#dnstring) property is not being populated.
Can anyone tell what I'm doing wrong?
Thanks,
Jim
Related Content
- 4 years ago
- 3 years ago
- 6 years ago