1
votes

I have two scenarios in my feature file

@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'

Two scenario I defined are

val scenario1=scenario("singleusers").exec(karateFeature("classpath:perf/foobar.feature@name=foo")) .pause(3) .exec(karateFeature("classpath:perf/foobar.feature@name=bar"))

val scenario2=scenario("ramp10Usersin30secs").exec(karateFeature("classpath:perf/foobar.feature@name=fooRamp")) .pause(3) .exec(karateFeature("classpath:perf/foobar.feature@name=barRamp"))

setUp( scenario1.inject(atOnceUsers(1)).protocols(protocol), scenario2.inject(rampUsers(10) during (30 seconds)).protocols(protocol) ) What I get is

Request users metrics
foo     11     <responseTime>
bar     11     <responseTime>

I want to see in my report like

Request users metrics
foo     1     <responseTime>
bar     1     <responseTime>
fooRamp 10    <responseTime>
barRamp 10    <responseTime>

Is there any way that this can happen that I get separate names for single and ramp runs? Can nameresolver pick the different name for same feature scenario as per the scenario run in simulation? or do I need to create a duplicate scenario to achieve this?

1

1 Answers

0
votes

I don't understand the logic after re-reading your question, so just do whatever conditional code you need and set a single header. Setting comma-delimited values won't work, it will take only the first.

* def temp = doSomeLogicHere()
And header karate-name = temp

There are multiple ways you can do the logic, look at the karate.info property, maybe looking at the feature name may give you what you need.