0
votes

I'm creating JMeter tests for a service which context root may change depending on the host/environment. I'm trying to map the context root within the HTTP request path as follows:

Http request path

I've created a user defined variable as follows:

contextRoot user variable definition

I'm running my tests using jmeter-gradle-plugin and that's how I'm passing the context root as a command line parameter:

-PcontextRoot=/my-context-root

But I'm always getting 404 responses because JMeter is not replacing the variable with the parameter value as expected.

Any clue about what I'm doing wrong? Thanks in advance.

1

1 Answers

1
votes

Looking into Advanced Usage section JMeter Gradle Plugin seems to be supporting "normal" JMeter command-line arguments, therefore you should use -J argument instead of -P

J, --jmeterproperty {argument}={value}, Define additional JMeter properties

So substitute your -PcontextRoot=/my-context-root with -JcontextRoot=/my-context-root

References:

You can also omit this User Defined Variables and put your __P() function directly to the HTTP Request sampler path (or even better go for HTTP Request Defaults)