Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.
How to take key which defined in json data bank's custom column name box in the groovy script?
I want to use variable in groovy script which I have defined in json data bank's custom column name section.
Tagged:
0
Best Answer
-
Do something like the following, where you call the "getValue()" method in the ScriptingContext object, passing "Generated Data Source" as the data source name and the name of the custom column:
import com.parasoft.api.*; import soaptest.api.*; String doSomething(ExtensionToolContext context) { String value = context.getValue("Generated Data Source", "value1"); }
5
Answers
-
When extracting multiple values, you can use an XPath that uses the "string-join" function so you can delimit each value with a comma, for example. So, your data bank would contain a comma-separated list of the values. From your script, you can get the value of the data bank column and use the string "split" method to get the values as an array.
0