Access data source table in Groovy script
I am trying to access a table defined as a data source in a Groovy script as part of a web scenario test. This script just needs to get a substring of one of the columns in the table.
The error I am getting says 'com.parasoft.data.DataSourceException: No Data Source column named BookingNbr'. My data source is defined as type Table and has these columns: BookingNbr DefendantName DefendantLastName DefendantFirstName DefendantMiddleName .
The script is very basic and is this:
import com.parasoft.api.*;
import java.util.*;
public String getBookingNbrSubstring(ScriptingContext context)
{
String bookingNbr = context.getValue("DataHold", "BookingNbr").get(1);
Application.showMessage("BookingNbr: " + bookingNbr);
String partialBookingId = bookingNbr.substring(4)
Application.showMessage("partialBookingId: " + partialBookingId);
return partialBookingId;
}
Any suggestions as to why I am getting this error? Can the script not find the table data source? This seems like such a basic thing to do.
Thanks!
Thanks
Comments
-
My apologies. Somehow the 'Use data source' check box in the Edit Script window became unchecked and I did not notice that until just now. The script is working as it should now.
Sorry and Thanks!
0