2

I have some user defined variables:

SERVER_NAME myhost.com THE_HTTP_PROTOCOL HTTP LOOP_COUNT 2 

Then, I use a Recording Controller to capture my browser actions. Unfortunately, JMeter does more variable substitution than I'd like it to. For example, it substitutes ${LOOP_COUNT} into a web site name that contains "2", e.g., /host${LOOP_COUNT}/somePage. My favorite example of over-zealous variable substitution is my ${THE_${THE_HTTP_PROTOCOL}_PROTOCOL} Header Manager.

Is it possible to make the recording more selective about what variables can be used for substitution? For example, of the variables I've listed, I'd really only like SERVER_NAME to be substituted in.

I'm using JMeter 2.11.

3 Answers 3

2

For now you must disable User Defined Properties during recording.

Maybe you could open a bugzilla request here:

Note that variable substitution works better with Regex Matching checked (HTTP(S) Test Script Recorder component) as it will be much more intelligent.

But ensure if you use it you do not use values (usually short ones) that can be frequently in responses/requests.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the pointer to Bugzilla. It appears that bug issues.apache.org/bugzilla/show_bug.cgi?id=51826 covers my situation.
1

I wouldn't recommend to substitute variables during recording as the behavior may be flaky.

If you want to parametrize your recorded test it's better to go for

Actually I would set host and protocol as properties too as they can be set via command line, via Ant or Maven plugin or any other way of invoking JMeter. Besides properties can be shared across thread groups and variables have local scope.

Comments

1

I was able to work around the problem by adding a User Defined Variables (UDV) element to my workbench.

enter image description here

It defined:

THE_HTTP_PROTOCOL someStringThatShouldNeverBeMatched USER_COUNT someStringThatShouldNeverBeMatched 

Then, when I recorded, I did not get the unwanted variable substitutions.

Another option is to break up a monolithic collection of variables into smaller groups using User Defined Variables. Then, you can disable certain of those smaller groupings when you need to record. For example, you could put USER_COUNT into a "Flow of Control" UDV, and then disable it at recording time as shown below.

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.