在karate-config.js中,我最初仅通过使用callSingle(auth.feature)获得一次身份验证令牌,并且此身份验证令牌已在其他功能文件中重复使用。
我有要使用Karate-Gatling进行性能测试的用户/详细信息api。为此,我创建了一个UserSimulation类。该UserSimulation正在执行user-detail.feature 我有以下查询-
class UserSimulation extends Simulation {
def successThreshold = 99
def secondMillis = 1000
def percentiles: (Int, Int, Int, Int) = { ( ( 1.2* secondMillis).toInt, 1 * secondMillis, 1 * secondMillis, 1 * secondMillis) }
val (p1, p2, p3, p4) = percentiles
val protocol = karateProtocol(
"/users/{id}/detail" -> Nil
)
val trav = scenario("myuser").exec(karateFeature("classpath:features/users/user-detail.feature"))
setUp(
trav.inject(rampUsers(15) during (50 seconds)).protocols(protocol)
).assertions().assertions( // These assertions are getting applied on auth.feature as well, how to avoid this ?
List(
global.successfulRequests.percent.gte(successThreshold)
, global.responseTime.mean.lte(p1)
, global.responseTime.percentile1.lte(p1) //50th %
, global.responseTime.percentile2.lte(p2) //75th %
, global.responseTime.percentile3.lte(p3) //95th %
, global.responseTime.percentile4.lte(p4) //99th %
)
)
}
答案 0 :(得分:1)
当前无法忽略任何请求。
一种选择是将验证步骤分开并使用Feeder:https://github.com/intuit/karate/tree/develop/karate-gatling#feeders
如果您引用Gatling文档:https://gatling.io/docs/current/general/assertions/#scope-可能会将百分比断言“范围”化为组或名称。
以下是使用自定义网上论坛名称https://github.com/intuit/karate/issues/858#issuecomment-546410352
似乎成功的人说实话,我不认为有很多空手道用户使用百分位数断言。您能否确定是否有任何解决方案对您有用,它将为他人提供帮助。也请考虑做出贡献,我已将您的要求添加到了路线图中:https://github.com/intuit/karate/projects/3#card-22529251
答案 1 :(得分:1)
示例代码-
val protocol = karateProtocol(
"/users/{id}/detail" -> Nil
)
val trav = scenario("myuser").group("myUserGP"){exec(karateFeature("classpath:features/users/user-detail.feature"))}
setUp(
trav.inject(rampUsers(10) during (100 seconds)).protocols(protocol),
trav2.inject(rampUsers(1) during (100 seconds)).protocols(protocol)
).assertions(details("myUserGP" / "GET /myuser-service/users/{id}/detail").responseTime.mean.lte(p1),
details( "myUserGP" / "GET /myuser-service/users/{id}/detail").responseTime.percentile2.lte(p2),
details( "myUserGP" / "GET /myuser-service/users/{id}/detail").responseTime.percentile3.lte(p3)
) // You can check the complete request path to be passed in details("groupName","completePath") from Simulation.log file