线程如何在内部调用方案中的其他功能的情况下运行?

问题描述 投票:-1回答:1

我正在运行几个测试,其中我调用其他功能来进行验证并返回场景并进一步执行。

示例:

Given url Admin

And def name = '1-' + now()

And json myReq = read('Swagger-AuthThrottling.json')

And set myReq.swagger.info.title = title

And def basepath = 'country' + now()

And set myReq.swagger.basePath = basepath

And request myReq

When method post

Then status 200

And def APPIDFromPublisher = call read('classpath:examples/Services/GetAPIIDFromPublisher.feature') {'title': '#(title)'  }

And def APIIDPub = APPIDFromPublisher.APIIDPub

And def utils = Java.type('examples.Publisher.AddAdvancedThrottlingPolicy')
And def result = utils.main(title)


And def APPIDFromStore = call read('classpath:examples/Services/GetAPIIDFromStore.feature') {'title': '#(title)'  }

And def APIIDStr = APPIDFromStore.APIIDStr

And print 'APPIDFromStore for Qantas Gateway API: ' , APPIDFromStore.APIIDStr

我正在运行许多具有5个线程的结构的测试。

现在,我不确定运行此类测试时线程如何工作。

我的理解是,当我开始执行时,应该拾取5个测试用例,并且单个线程不应该在任何时候离开测试,直到它完成。理想情况下,我应该看到5个测试并行运行,一旦完成5个测试然后接下来5个应该拿起来。

但真正发生的是,5个线程获得5个测试用例,但显然是将测试留在中间(怀疑它离开了我在测试中间调用另一个功能的点)并从下一个接受另一个新测试插槽然后一些其他线程或可能是相同的线程再次完成半完成测试完成它。

总而言之,在并行5个线程的情况下,我理想地希望看到只有5个测试从头到尾开始和结束,并且只有在那之后才应该接下来的5个。但实际上,我看到在执行开始时运行了5个测试,但随后逐渐堆积了大量测试,然后为所有测试随机完成执行。

虽然完整执行不会因为线程的随机选择和测试离开而失败,但它正在为我的商店加载大量的API(我的测试主要是在商店中注册API)这会阻碍商店的性能。

能够更好地了解线程的运行情况并找到解决方案。

dsl karate
1个回答
0
投票

你在使用Parallel Runner吗?如果不是我无法理解这个问题,请按照这个过程,简单明了:https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

© www.soinside.com 2019 - 2024. All rights reserved.