Forum Discussion

xworker's avatar
xworker
Occasional Contributor
13 years ago

Inject context into groovy class

Hi

I am trying to structure my groovy a bit more with classes. However now I get an error saying groovy.lang.MissingPropertyException: No such property: context for class: GameWSTool
My class is this:

class GameWSTool{


def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def project = context.testCase.testSuite.project
def testSuite = project.testSuites['StartingPoint'];
def testCase = testSuite.getTestCaseAt(1) //GenerateInputData

def noItems = 10
def i =0
def sb = new SwingBuilder()

static void main(String[] args){
def tool = new GameWSTool()
tool.show()
}


Do I need to inject the context somehow?

Thanks

1 Reply

  • nmrao's avatar
    nmrao
    Community Hero
    Are you trying to run this from SOAPUI? Do not see closing braces for class and method tool?
    Will you please post full stacktrace when the problem is seen?