Forum Discussion
Hi!
Thanks for your help.
I have landed in a short term solution (that seems to work during my local tests), where I in the MockRunListener.onMockRunnerStart event create the connection to the database (releasing it in the MockRunnerStop event) and saves it in the contect.
Then in the response script I execute the sql query
def sql=mockRequest.context.dbConnection
if(mockRequest.context.dbConnection!=null)
{
log.info "Data..comming"
sql.query('SELECT HEAD....
So...
* I fetch data from db for each request
=> I have abonded the datasource since I didn't get it to work.
=> I have to manually write the select sqls in the differents services
Do you see any apperent disadvantages with this approach?
Hi,
> Do you see any apperent disadvantages with this approach?
No, I don't. Approach seems to be fine and, actually, it coincides with what I meant under option b) in my reply.
I don't see any really better way at the moment as the Datasource functionality seems to be of a 'static' nature.
The only thing that I can suggest now is to address Support directly via the https://support.smartbear.com/message/?prod=ReadyAPI form ans ask them if they can suggest something better. (I would appreciate it if you update this thread with the whatever result you'll get in this case.)