Can we do parameterization using groovy scripts?

Questions by sathyaageetha

  
Showing Answers 1 - 3 of 3 Answers

Yes, You can parametrization using groovy scripts,
in groovy script you must declare the variables to pass the mocservice response accordingly.
See example for better understand:
-------------------------------------------------

Code
  1. def groovyUtils=new com.eviware.soapui.support.GroovyUtils(context)

  2. def holder=groovyUtils.getXmlHolder(mockRequest.requestContent)

  3. def asset=holder.getNodevalue("//homepage/credit");

  4. def asset=holder.getNodevalue("//homepage/debit");

  5. if(context.asset=="90828882")

  6. {

  7. return "sample1"

  8. }

  9. else

  10. {

  11. if(context.asset===null)

  12. return "sample2"

  13. }

  Was this answer useful?  Yes

Ellakkiya

  • May 6th, 2013
 

Yes. You can parametrize a variable for a Testcase, Testsuite and Project using the following code..

This will set the parameters msg, msgID in ur testcase u created.

Code
  1. def TestCase = testRunner.testCase

  2. TestCase.setPropertyValue("msg",msgUuid)

  3. TestCase.setPropertyValue("msgId",msgId)


  Was this answer useful?  Yes

Ellakkiya

  • May 6th, 2013
 

Yes. You can parametrize the variable for Testcase, Testsuite, Project by using Groovy script

Code
  1. def TestCase = testRunner.testCase

  2. TestCase.setPropertyValue("msgUuid",msgUuid)

  3. TestCase.setPropertyValue("msgId",msgId)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions