Powerful is not loadrunner, but spring and dubbo. Recently, I changed jobs and changed jobs. The new company uses dubbo and a set of middleware based on dubbo's own packaging, so the performance test needs to write scripts for dubbo class interfaces. There is already a Dubbo article on loadrunner on the Internet, which initializes the connection and call to the dubbo provider programmatically, but because the company's own package of middleware does not provide programmatic access, it can only be read by reading the XML configuration file. Way to initialize, so a simple modification to the script. Copy the spring framework and dubbo related jar packages to the loadrunner script folder, add the current directory to the classpath, and also copy the applicationContext.xml to the script folder, which defines the provider information of dubbo. The content of the loadrunner script is as follows:
/ *
* LoadRunner Java script. (Build: _build_number_)
*
* Script. Description:
*
* /
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.alibaba.dubbo.demo.DemoService; // Import your defined interface here
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
}
The above script is a very simple example, using the JMeter wrapper Java request can also implement the invocation of the Dubbo class interface, followed by an empty supplement.