As I said in the question, is it possible to pass jmeter variables (passed through -J) into a JUnit Request
in order that it can be used internally to the junit test?
It sounds feasible as the Apache Junit Request docs indicate that:
... JMeter currently runs the test methods directly, rather than leaving it to JUnit. ...
This would indicate that jmeter could control passing parameters but I've found no supporting documentation and there's no obvious mechanism through the JUnit Request sampler config.
Background
I was hoping to use CSV Data Set Config
to load a user pool (as in Victor Klepikovskiy excellent top tips) and have a randomly obtained user provided to my unit-tests (for use across the thread/ loop). I've found an alternative way of doing what I want (but use my own user pool accessed from within the junit tests). I know you could manage the login through Http Request
too (as above) but we amanage the rest-service calls internally to junit so that they can be run as junit tests as well. I was interested in being as non-intrusive as possible.
A second reason for doing so might be to have a single junit test method but have it parameterised to suit the scenario.
Addendum
For what it's worth, I'm happy with my current alternative approach but still interested in how you might be able to do this for future reference. I'm fairly new to jmeter but expect to see a fair bit more of it. Was also thinking of looking at the pre-processors but not sure how these could interface with the Junit Request.