I have Karate feature with a long list of operations. I need to manually have some test data setup before running these tests which is essentially one sql query. Is there a way we can have this query run in "background" in Karate? I'm trying to update all the values in status which aren't "ready_to_test" to "ready_to_test".
Say my query is
update my_table
set status = 'ready_to_test'
where status != 'ready_to_test';
EDIT: I am trying to run the update query as follows
use JDBC to setup test data
* def config = {username: 'postgres', password: 'postgres', url: 'jdbc:postgresql://localhost:5432/postgres', driverClassName: 'org.postgresql.Driver'}
* def DbUtil = Java.type('com.utils.DbUtils')
* def db = new DbUtil(config)
* def correctStatus = 'ready_to_test'
* def testData = db.cleanRows('UPDATE MY_TABLE M SET M.STATUS = ' 'WHERE M.STATUS != ' + correctStatus)
Also tried * def testData = db.cleanRows('UPDATE MY_TABLE SET STATUS = 'ready_to_test' WHERE STATUS != 'ready_to_test)