I have JMeter script having many test elements like test fragments, include controllers , beanshell samplers, ssh samplers, SFTP samplers, JDBC etc. When I tried running JMX script using Java code( below) some of the test elements are getting skipped.One of the major problem is it is skipping Test fragments with out going inside another JMX script.We are running Test Fragments using include controllers which we tried all the combinations of paths.Please help to run test fragments inside JMX file using below Java code.
I tried all the paths inside JMX scripts, I added all JMeter Jars in maven repository etc.
public class Test_SM_RS_001_XML extends BaseClass {
public void Test121() throws Exception {
StandardJMeterEngine jmeter = new StandardJMeterEngine();
Summariser summer = null;
JMeterResultCollector results;
File JmxFile1 = new File(/path/to/JMX/File/test121.jmx");
HashTree testPlanTree = SaveService.loadTree(JmxFile1);
testPlanTree.getTree(JmxFile1);
jmeter.configure(testPlanTree);
String summariserName = JMeterUtils.getPropDefault("summariser.name", "TestSummary");
if (summariserName.length() > 0) {
summer = new Summariser(summariserName);
}
results = new JMeterResultCollector(summer);
testPlanTree.add(testPlanTree.getArray()[0], results);
jmeter.runTest();
while (jmeter.isActive())
{
System.out.println("StandardJMeterEngine is Active...");
Thread.sleep(3000);
}
if (results.isFailure())
{
TestAutomationLogger.error("TEST FAILED");
Assert.fail("Response Code: " + JMeterResultCollector.getResponseCode() + "\n" + "Response Message: " + JMeterResultCollector.getResponseMessage() + "\n" + "Response Data: " + JMeterResultCollector.getResponseData());
}
}
}
I expect to run Test fragments inside JMX file ,but it is not considering and Skipping.