'How to use user defined variable in Jmeter as server name or Ip while writing scripts using Transaction controller and Test script controller

When I am using the Jmeter while recording the script, I want to use a user-defined variable which is the website address. When an HTTP request is created by the Test script recorder, the Server name or IP is created automatically, but what I want is to set those server names manually using a variable. How can I do that?



Solution 1:[1]

I don't know how you're recording your test, but when you create the recording test plan from the Recording Template it asks you for the protocol and hostname and populates them in the HTTP Request Defaults so you basically have server name in one place only and in the HTTP Request samplers it can be empty.

If you want to have it as a variable you can define one in the User Defined Variales configuration element and replace the value in the HTTP Request Defaults with the JMeter Variable reference.

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T