Forum Discussion

codehausss's avatar
codehausss
Contributor
9 years ago

SoapUI scripting with Eclipse - is it possible?

As i know we can add external library to Java project when working with Selenium webdriver on Eclipse.   Is it possible to do the same for SoapUI? I am trying to create Groovy project on Eclipse a...
  • nmrao's avatar
    nmrao
    9 years ago
    1. parseText() method is of JsonSlurper class. However, the package is different. Use the following to get it right
      import net.sf.json.groovy.JsonSlurper
    2.  You should be able to use SoapUI's API, however, should be aware that soapui invokes / maintains certain objects when it is started.
    • For eg: If you open any groovy script, you would see certain variables like testRunner, context, log on the top of the script editor.
    • Similarly, if you open setup script of testSuite, you would see runner, context, log etc.
    • And in the script assertion, you would see messageExchange, context, log etc.
    • So, if you need these variables in your class, your methods accessing these variables should have them as parameters. Then you would be able to access them without any issue.
    /**
    * this example class is a user class which access soapUI variables
    **/
    import com.eviware.soapui.model.iface.MessageExchange
    public class TestAssertion {
      public boolean myScriptAssertion(MessageExchange messageExchange) {
      /// do the stuff
      }
    }
    

    And the above class needs to be called from your script assertion like

    def myTestAssertion = new TestAssertion()
    log.info myTestAssertion.myScriptAssertion(messageExchange)

    Please revert back if you have any question.