TraceyK
13 years agoOccasional Contributor
[Res] Use event listener with Groovy script to run test case
Hi,
I'm using an event listener to run a Groovy script that runs a test case.
import com.eviware.soapui.model.testsuite.TestRunner.Status
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
log.info("============Get Properties for Report================= ")
def testStatus = false
def propsTest = testRunner.testCase.testSuite.project.testSuites["Phoenix REST API Test Suite"].testCases["GetPropertiesForReport"]
def runner = propsTest.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)
The event listener is TestSuiteRunListener.beforeRun.
When I launch TestRunner (through the soapUI UI) I get the following in the log:
14:55:17,153 INFO [log] ============Get Properties for Report=================
14:55:17,168 ERROR [EventHandlersRequestFilter] groovy.lang.MissingPropertyException: No such property: testCase for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner
14:55:17,177 ERROR [SoapUI] An error occured [No such property: testCase for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner], see error log for details
The error references the line def propsTest = testRunner.testCase.testSuite.project.testSuites["Phoenix REST API Test Suite"].testCases["GetPropertiesForReport"].
What have I missed?
Thank you,
TraceyK
I'm using an event listener to run a Groovy script that runs a test case.
import com.eviware.soapui.model.testsuite.TestRunner.Status
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner
log.info("============Get Properties for Report================= ")
def testStatus = false
def propsTest = testRunner.testCase.testSuite.project.testSuites["Phoenix REST API Test Suite"].testCases["GetPropertiesForReport"]
def runner = propsTest.run(new com.eviware.soapui.support.types.StringToObjectMap(), false)
The event listener is TestSuiteRunListener.beforeRun.
When I launch TestRunner (through the soapUI UI) I get the following in the log:
14:55:17,153 INFO [log] ============Get Properties for Report=================
14:55:17,168 ERROR [EventHandlersRequestFilter] groovy.lang.MissingPropertyException: No such property: testCase for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner
14:55:17,177 ERROR [SoapUI] An error occured [No such property: testCase for class: com.eviware.soapui.impl.wsdl.testcase.WsdlTestSuiteRunner], see error log for details
The error references the line def propsTest = testRunner.testCase.testSuite.project.testSuites["Phoenix REST API Test Suite"].testCases["GetPropertiesForReport"].
What have I missed?
Thank you,
TraceyK