New here - need some help with a Groovy script.
Hi!
I've just started with SoapUI and Groovy scripting. I can write code, but have never really worked with Java before (I'm more of a Python and C++ gal).
I'm trying to write a Project level setup script that will utilize an existing test case that I have. Basically, all I want to do is run this particular test case as a project setup script. I've attached a picture of the test case setup.
To summarize, I need to grab the value of the property that is returned in the DataSource step, and then use said value in the test case that follows it (just as would happen if I were simply running the test case from the GUI). I have the following code:
// get TestCase
def tc = testRunner.testCase.testSuite.project.testSuites["Basic Operations"].testCases["Get and Clone Scenario"]
//get simulation_id from data source
def sim_id = content.expand( '${Get Model ID#simulation_id}' )
log.info "Project level model simulation ID = $sim_id"
// set model clone properties
tc.setPropertyValue("id", "sim_id")
// run test synchronously
def runner = tc.run( null, false )
// log the results
log.info "Status: $runner.status, time taken for TestCase was: $runner.timeTaken ms"
I get the following error:
Caused by: groovy.lang.MissingPropertyException: No such property: testRunner for class: Script6
I also have a hard time reading Java tracebacks and am not sure exactly what line this error is happening in, though I'm guessing it's in the "tc.setPropertyValue" line.
I am obviously missing something but have no idea what. Any help would be much appreciated! Thanks!
"project" object is directly accessible. Hope you can use it to get the right test.
See right top corner of the screen for the other objects which are available.