Forum Discussion

sboris's avatar
sboris
Occasional Contributor
3 years ago
Solved

How to reuse a groovy teststep inside the project assertion scripts

I have a working groovy test script (a helper Cookie class with instance creation inside the script): context.setProperty("Cookie", new Cookie(log, context, testRunner)) and re-using the Cookie: ...
  • sboris's avatar
    3 years ago

    I didn't find the problem during step-by-step debugging. It started working (have no explanation):

    import com.eviware.soapui.support.types.StringToObjectMap
    import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
    
    def runner = new WsdlTestCaseRunner(messageExchange.modelItem.testStep.testCase, new StringToObjectMap());
    
    def mySteps = messageExchange.modelItem.testStep.testCase.testSuite.project.testSuites["Helpers"].testCases["Objects"].testSteps["Cookie"];
    mySteps.run(runner,context);
    
    log.info context.Cookie.info()
    def cookies = context.Cookie;
    log.info cookies.info()
    log.info context.getProperty("Cookie").info()