JMeterContextService.getContext().setVariables(new JMeterVariables());
StandardJMeterEngine engine = new EmulatorJmeterEngine();
JMeterThreadMonitor monitor = new EmulatorThreadMonitor();
JMeterContextService.getContext().setEngine(engine);
HashTree hashtree = new HashTree();
hashtree.add(new LoopController());
JMeterThread thread = new JMeterThread(hashtree, monitor, null);
thread.setThreadName("test thread");
JMeterContextService.getContext().setThread(thread);
ThreadGroup threadGroup = new org.apache.jmeter.threads.ThreadGroup();
threadGroup.setName("test thread group");