/*
* LoadRunner Java script. (Build: _build_number_)
*
* Script. Description:
*
*/
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.alibaba.dubbo.demo.DemoService;//这里导入你定义的接口
import lrapi.lr;
public class Actions
{
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
DemoService demoService;
public int init() throws Throwable {
demoService = (DemoService) context.getBean("demoService");
return 0;
}//end of init
public int action() throws Throwable {
lr.start_transaction("dubbo");
String hello = demoService.sayHello("dio");
System.out.println(hello);
lr.end_transaction("dubbo",lr.PASS);
return 0;
}//end of action
public int end() throws Throwable {
return 0;
}//end of end
}
以上脚本是个很简单的示例,使用jmeter封装java request同样可以实现dubbo类接口的调用,后续有空再补充。