Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

For the purpose of my test, i need to test the same endpoint is capable of using both GET/POST http method. What is the easiest way, how i can do it without creating duplicates of the script?

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
182 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can normally parameterize the HTTP request method by creating a simple CSV file with the following contents:

method
GET
POST

once done you can add a CSV Data Set Config element and set it up like:

enter image description here

and in your HTTP Request sampler just use ${method} JMeter Variable

enter image description here

That's it, you can now run your request and it will hit the endpoint twice using different methods:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...