How to use a runtime parameter in groovy
I am using a groovy script in which I want a to enter a parameter in the method at the runtime.
For e.g. : def userId(String input) {
//my method
}
How can I derive the input variable while I try to run the API test case
Answers
-
If you are using an Extension Tool, your method must take 0, 1, or 2 arguments where the first is the input to the tool and the second is a com.parasoft.api.ScriptingContext. So, if you want your script to read the text from the input to the Extension tool then use the first argument. If you want to read other types of parameters, like data source columns, data bank columns, test variables, environment variables, etc. then call the appropriate methods on the ScirpingContext object. The SOAtest Help dialog includes the javadocs for classes in com.parasoft.api. There are also various examples in the user's guide under Extensibility and Scripting Basics.
0