Testing / Apache JMeter Interview questions
How do you pass command-line properties into a JMeter test?
Pass a property with -J when invoking JMeter, like jmeter -n -t test.jmx -Jthreads=100 -Jhost=staging.example.com, then read that value inside the test plan using the __P() function, such as ${__P(threads,50)}, where the second argument is a fallback default if the property wasn't actually passed.
This is the standard mechanism for making a single .jmx file reusable across environments and scenarios - the same test plan can target staging or production, or run with 10 threads locally versus 500 in a CI pipeline, purely by changing command-line arguments rather than editing the file itself.
This is distinct from -D, which sets JVM system properties (affecting JMeter's own runtime behavior, like proxy settings) rather than test-plan-level properties, so it's worth being precise about which flag actually matches the intended use case.
More Related questions...
