I want to write JMeter requests in Java. I found some examples by googling but I am not understanding how to assert the response i.e. the way we use Response Assertion to check whether the page was loaded successfully or not. Please share step-by-step process for JMeter with java coding.
closed as too broad by corsiKa♦ Jan 8 '16 at 16:35
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
You can take a look at 5 Ways To Launch a JMeter Test without Using the JMeter GUI guide to learn how to run existing JMeter test scenario from Java code and how to create a JMeter test purely in Java.
Also refer jmeter-from-code snippet for working example.
In regards to implementing assertions, you can create a simple test plan i.e. having one request and one assertion, load it via SaveService.loadTree() method and inspect resulting HashTree to see how does it look under the hood.
Please refer the below link. Thought this might work. https://javaworks.wordpress.com/2013/06/28/beanshell-assertion-in-jmeter/