LoadRunner Invoke Java Program-performance test __java

Source: Internet
Author: User
In order to make full use of LoadRunner scene Control and analyzer, we can better control the script loading process, so as to show more intuitive and effective scenario analysis chart. This session will focus on LoadRunner how to invoke Java test code to complete the stress test.

Usually when we do some server stress testing, we inadvertently want a client to complete the call to the server sample, so that we can record directly through the LoadRunner, it is really convenient for testers. However, developers

If you do not have so much time to serve the testers, it may be more tragic, you can only try to call the interface to complete the stress test, so you need to have some code of the foundation. Of course, if you complete the call to the interface code, make sure

LoadRunner can record correctly, that's a bit of a hassle. Most of the time, our interface pressure may indeed not be demonstrated through the client side, which can only be done in pure code, either multithreading or repeated calls, but for testing

The results are not so convenient to collect. So we still have to approach the advantage of some tools, take the director, for us to use, LoadRunner Chart analysis is the best of all tools, just as it also supports Java code, C + + and other call interface, which

Take Java for example.

Usually in a project file, we want to make a call to one of the Java files, but this Java code is always with the other code to invoke each other, so I need to introduce a lot of Java packages or some jar packages, the following is the practice to detail

To detail the steps of LoadRunner invoke Java code, my environment here is loadrunner11,jdk1.6, engineering development is Java+flex, complete is a unified login interface test. The specific steps are as follows:

1, the Java engineering files packaged into a jar format, such as my project here for Logindemo, packaging jar after the Logindemo.jar

2, the Java project files under the Lib directory to find out, lib file is basically a jar package, this is the project file call Jar Package

3, open LoadRunner new Java vuser script, first run Ha, see if the script executes correctly, and save the file

4, will Logindemo.jar and Lib jar all into the loadrunner under the Classpath, the premise is to ensure that JDK files to be imported into LR, in the LR vuser--"Run-time settings, as shown in the following figure;"

   

5, after the completion of the above operation, this time we can in the VUser script to introduce Java in the call program, I began to import the introduction of the time, found very strange, the first incredibly successful, but the backstage has been reported to find the package, suspended for a long time, So the introduction of the package, found or really can, and then began to run, found very useful, and the program call is really OK.

Note: There is really no special action here, mainly for the way the jar package is invoked, you may need to pay attention to several points:

1, in the introduction of the jar package, such as the above the introduction of the Jar folder in the way, it is not feasible, this is a doubt, so you can only choose to import all the jar package together OK

2, when the introduction of Java package file in VUser, import way incredibly is occasionally do not work, so the choice of package mode is absolutely feasible

3, after the introduction of the Java package VUser may appear some error, the basic is the jar file situation, as long as the LoadRunner to find the Classpath basic no problem, there is the JDK must first import, or will directly prompt the process is terminated,

Cannot run Java file

4, LoadRunner for the introduction of Java files have a variety of ways to call the jar package here is our usual application of the most, but also the most convenient. Of course, you can also copy the Java compiled class file to the LoadRunner installation path

Classes, you must copy the entire package folder of Java class to be executed in such a way that you need to spend the time of the call, and the jar package that will eventually be invoked will be imported under Classpath.

As for the implementation of Java business logic, can be implemented in Java, and then VUser directly invoke the method interface, indifferent also can be completed in VUser. Then you can set the number of virtual users in the scene to test the scene, and then based on the results of the scene test points

The chart is basically the same as the way it was tested after other recordings.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.