Forum Discussion

amitst's avatar
amitst
Occasional Contributor
6 years ago
Solved

context.expand with dynamic string not working in dynamic property expansion

I have a property named "username0" saved at project level.   In my groovy script, the following code works and logs the value of property "username0" (actually I am using context.ThreadIndex her...
  • JHunt's avatar
    6 years ago

    This is because Inline scripts don't work when you have braces in them. So you can't put in expansion that includes braces inside an expansion.

    This also limits those of us who want to write Groovy stuff with closures inline, like....

    ${="abc".with { it.toUppercase }}

    But if you can figure out how to do what SoapUI does when it processes expansions, you might be able to get away with it.

    This should work for you:

    <mytag>${=context.testCase.project.getPropertyValue('username' + context.ThreadIndex)}</mytag>