This is my current Karate test scenario. I am posting a message using REST API and then validating it in certain tables in the database. By default status in a database table goes to wait . After 30 sec-1 min a batch job processes it and changes it to either success or failure status. How do I capture this part? in the below code:- if finalstatus = Success, its passed and if its changed to failed, the TC is failed.
* url apiurl
And request data
When method POST
Then status 200
* def id11 = db.readRows('select id1, payload1 from test1 where id = \'' + response + '\'')
And eval Thread.sleep(600)
And match id11.id1 == response
And match id11.payload1 == data
* def id22 = db.readRows('select id2, msg2 from test2 where id2 = \'' + response + '\'')
And eval Thread.sleep(400)
And match id22.id2 == response
And eval Thread.sleep(300)
* def xmlPayload = dba.readRows('select top 1 final_id, payload, status from test3 order by final_id desc')
* def xml = xmlPayload[0].payload
* def happyid = xmlPayload[0]. final_id
* def finalstatus = xmlPayload[0].status
Examples:
| read('data.json') |