I'm new to JMeter and am trying to write some Groovy Samplers. I am having trouble finding documentation/examples of how to communicate with the JMeter framework from the script code. I was hoping someone could point me to a good starting point for the documentation.
I tried the following in a JSR223 sampler
import org.apache.jmeter.samplers.SampleResult;
println(" running test")
SampleResult sr=new SampleResult();
sr.setResponseCode("300");
sr.setSuccessful(false);
sr.setErrorCount(2);
sr.setResponseData("This is the response");
ResponseCode=300
return sr;
But it looks as if it had no effect. Looking in a results tree listener output the sampler result is
Thread Name: Thread Group 1-1
Sample Start: 2016-03-22 17:38:07 CDT
Load time: 12
Connect Time: 0
Latency: 0
Size in bytes: 0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 0
Response code: 200
Response message: OK
....