Extension tool script failing
Newbie please bear with me.
I have a working groovy script
import groovy.json.*
def jsonFile = new File('C:\location\serviceresponse.json')
def jsonContent = new JsonSlurper().parseText(jsonFile.text)
jsonContent.someobject.each { tb ->
println "${targetObejct}
}
My goal was to do the same thing in SOATest.
In the case of json File I want to execute the get service store the response into json data bank store the root object with a new e.g.
import com.parasoft.api.*
import groovy.json.JsonSlurper
def jsonFile = new File('${databankStoredObject}') or get some other way of referencing databank extracted object.
and I stored the service response
I added groovy-3.025.jar to the classpath, script seems not getting executed. I commented out all other statements including the above one, just left the import command intact.
Answers
-
See Extensibility Examples for SOAtest.
or get some other way of referencing databank extracted object
Notice that your script must define a method. One of the arguments to your method is a "context" object. This "context" object has various methods including those for accessing data source or data bank columns. In particular use
context.getValue("Generated Data Source", "columnName")
to retrieve the value of a custom data bank column namedcolumnName
. The first argument is the data source name but you useGenerated Data Source
to access custom data bank columns.I added groovy-3.025.jar to the classpath
Do not do this. Groovy works out-of-box.
script seems not getting executed
Once your script defines a method you can select it from the "Method" box.
0