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:
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.
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 )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.