我们如何在karate上执行异步特性测试调用



我想运行一个长时间运行的api调用,然后使用另一个api调用终止它。我尝试了以下方法:

* def longQuery = async function() { karate.call('this:submit-long-running-sync-query.feature', {queryID: queryID})}
* karate.eval(longQuery())

这不会评估异步函数,只在超时时返回。

* def longQuery = function() { karate.call('this:submit-long-running-sync-query.feature', {queryID: queryID})}
* eval new java.lang.Thread(karate.toJava(longQuery)).start()
Caused by host exception: com.intuit.karate.KarateException: The value 'DynamicObject<JSFunction>@4bc59b27' cannot be passed from one context to another. 
* def longQuery = function() { karate.call('this:submit-long-running-sync-query.feature', {queryID: queryIDtest})}
* eval new java.lang.Thread(longQuery).start()
Exception in thread "Thread-1" java.lang.IllegalStateException: Multi threaded access requested by thread Thread[Thread-1,5,main] but is not allowed for language(s) js

我们如何在karate上执行异步特性测试调用?

不,空手道的JS引擎有点"不同的";并且不支持CCD_ 1。

对于这些高级情况,建议编写一点Java";"胶水";代码(仅限一次性(。请以此为例:https://twitter.com/getkarate/status/1417023536082812935

最新更新