我的功能文件中有两种情况
@name=foo @name=fooRamp
Scenario : verify Performance for foo
Given def query = read('classpath:perf/testData/foo.graphql')
And request {query:'#(query)'}
And header karate-name = 'foo','fooRamp'
@name=bar @name=barRamp
Scenario : verify Performance for bar
Given def query = read('classpath:perf/testData/bar.graphql')
And request {query:'#(query)'}
And header karate-name = 'bar,'barRamp'
我定义的两种情况是
valcens1 = scenario(“ singleusers”)。exec(karateFeature(“ classpath:perf/foobar.feature@name=foo”)) .pause(3) .exec(karateFeature(“ classpath:perf/foobar.feature@name=bar”))valcens2 = scenario(“ ramp10Usersin30secs”)。exec(karateFeature(“ classpath:perf/foobar.feature@name=fooRamp”)) .pause(3) .exec(karateFeature(“ classpath:perf/foobar.feature@name=barRamp”))
setUp( scheme1.inject(atOnceUsers(1))。protocols(protocol), scheme2.inject(在30秒内(rampUsers(10)))。protocols(协议) ) 我得到的是
Request users metrics
foo 11 <responseTime>
bar 11 <responseTime>
我想在报告中看到类似
Request users metrics
foo 1 <responseTime>
bar 1 <responseTime>
fooRamp 10 <responseTime>
barRamp 10 <responseTime>
我是否有可能通过单次运行和加坡运行获得单独的名称? nameresolver可以为模拟中运行的场景选择相同功能场景的不同名称吗?还是我需要创建一个重复的场景来实现这一目标?
答案 0 :(得分:0)
重新阅读您的问题后,我不了解逻辑,因此只需执行所需的任何条件代码并设置一个标头即可。设置逗号分隔的值将不起作用,它将仅使用第一个。
* def temp = doSomeLogicHere()
And header karate-name = temp
执行逻辑的方法有多种,请查看karate.info
属性,或者查看功能名称可能会为您提供所需的信息。