0

Based on the Jmeter - Using GET/POST with single call i tried to perform GET/POST calls with single call, solution works fine if i don't use some data source.

But, i my test, i already use csv file as data source. My current set up is like:

TC_name, login_id, excpecedCode
test_with_valid_login_id,2132537288,200
test_with_unknown_login_id,11111,200
test_with_known_login_id,1,200
test_with_invalide_login_id,dsddfd,400
test_with_negative_login_id,-100,400

enter image description here

enter image description here

And, in the csv i have 5 test cases which are driven my test. If i try to add second csv, i am not able to perform both GET/POST operation for every single test cases.

I try to add

enter image description here

But, still i am not able to get 10 executions based on the 5 test cases present in the csv data config.

What is the easiest set up, so i can drive my test to run both GET/POST on the top of While loop driven by csv?

1 Answer 1

1

Why don't you just change your CSV file to include the HTTP Request method along with all other parameters like:

TC_name, login_id, excpecedCode, method
test_with_valid_login_id,2132537288,200,GET
test_with_valid_login_id,2132537288,200,POST
test_with_unknown_login_id,11111,200,GET
test_with_unknown_login_id,11111,200,POST
test_with_known_login_id,1,200,GET
test_with_known_login_id,1,200,POST
test_with_invalide_login_id,dsddfd,400,GET
test_with_invalide_login_id,dsddfd,400,POST
test_with_negative_login_id,-100,400,GET
test_with_negative_login_id,-100,400,POST

If the CSV file is not something you can control you can

  1. Create a simple text file called methods.txt in the "bin" folder of your JMeter installation looking like:

    GET
    POST
    
  2. Put the request(s) you want to repeat under the Loop Controller with 2 Loops
  3. Use the following __groovy() function instead of ${method} in the HTTP Request sampler:

    ${__groovy(new File('methods.txt').readLines().get(vars.get('__jm__Loop Controller__idx') as int),)}
    
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.