Forum Discussion

_ivanovich_'s avatar
Frequent Contributor
5 years ago

Groovy Calling method returns error


i have a file test1.groovy in the soapui project path

in soapui i have a groovy code named test2


import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
import groovy.sql.Sql
import java.sql.ResultSet;

public class groovyUtilities {
def context
def testRunner
def log
def Getdata() {
def id = testCase.testSuite.project.setPropertyValue("idx","abc") id


in test2

def groovyUtils = new
def projectPath = groovyUtils.projectPath
def scriptPath = projectPathGroovyScriptEngine gse = new GroovyScriptEngine(scriptPath)
externalScript = gse.loadScriptByName("test1.groovy")
instance = externalScript.newInstance(context:context, log:log, testRunner:testRunner)
assert instance != null


When i run test2 it returns:

groovy.lang.MissingPropertyException: No such property: testCase for class: groovyUtilities


What is missing here?

Thank you

4 Replies

  • _ivanovich_'s avatar
    Frequent Contributor

    The code returns error because i'm soapui open source?

    Will it work in soapui pro?

    Thank you

    • nmrao's avatar
      Champion Level 3
      Because the testCase property is not available in the class.
      • _ivanovich_'s avatar
        Frequent Contributor

        The testCase property is not available in the class.

        How can we resolve this probleme? Should i add some librairies?

        Did i miss something in my code? or is it because i'm not using the pro version?