空手道中如何等待数据库表中的状态从等待变为成功?

问题描述 投票:0回答:0

这是我当前的空手道测试场景。我使用 REST API 发布一条消息,然后在数据库中的某些表中验证它。默认情况下,数据库表中的状态为 wait 。 30 秒到 1 分钟后,批处理作业将对其进行处理并将其更改为成功或失败状态。我如何捕捉这部分?在下面的代码中:-如果finalstatus = Success,则通过,如果更改为failed,则TC失败。

* 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') |
karate
© www.soinside.com 2019 - 2024. All rights reserved.