0
votes

I have an extenal test data file (excel/csv).

extenal test data file

My requirement is In my jmx tree my first http request should take the value from ContentName column, ex: www.sample.${ContentName} and to that i need to apply JsonPathExtractorApi column as jp@gc - JSON Path extractor.

Please not that i need to have only one json path extractor which takes ${JsonPathExtractorApi}. where for Hotel i need to extract 4 times where as for ship 2 times, for Gem 3 times as the number of JsonPathExtractorApi against that.

Below i have attached the sample which im trying to implement.

SampleJMX file

Problems : 1.How can find the total number of JsonPathExtractorApi against each ContentName.

2.If i keep my CSV outside the loop controller i cant traverse through csv ,every time i get first value(ContentName).

3.If i keep csv inside loop,i can traverse through csv but cant take the contentvalue before it(for the first http sampler where i have to take response data)

Please can anyone take time and suggest on this.Any other approach is also acceptable if it serve the purpose.

Thanks in advance.

1

1 Answers

1
votes

If you don't have any control of this "external data file" the only solution would be going for 2 If Controller instances

Example Test Plan outline:

  • Test Fragment
    • What do you have under the Loop Controller
  • Thread Group
    • CSV Data Set Config
    • If Controller, condition: ${__groovy(!vars.get('ContentName').equals(''),)}
    • If Controller, condition: ${__groovy(vars.get('ContentName').equals(''),)}
      • Module Controller - point to the Test Fragment

Demo:

JMeter Demo Test Plan for If Controller and Module Controller