Can you use a Test Scenario variable in a test script?

I have a variable in a test scenario that gets set from a REST call's response using an XML databank (variable is named x and gets set to the number of widgets). I would like to then perform an operation on that widget that requires the use of a groovy script (this operation accesses a row in a writable datasource and the script tells it which row and column to use). I would like to not hardcode the row number but use the variable x in the groovy script. I plan to have a loop in the test scenario that decrements x after each run therefore grabbing a different row for each time the test is run in the loop (row 37, row 36, row 35 .... until 0). The current groovy script is as follows:

import com.parasoft.api.*;

public String getWidget(ScriptingContext context)
return context.getValues("datasourceName", "columnName").get(37);

Can I do something like this?

return context.getValues("datasourceName", "columnName").get("${x}");.

Thanks again.


Sign In or Register to comment.