LoadRunner calling Java programs-performance testing

Source: Internet
Author: User

To take full advantage of LoadRunner's scene controls and analyzers, we have better control of the script loading process to show more intuitive and efficient scenario analysis charts. This session will focus on how LoadRunner calls the Java test code to complete the stress test.

Often when we perform some server stress tests, we inadvertently want a client to complete a call to the server example so that we can record directly through LoadRunner, which is really handy for testers. However, the developer

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 finish calling the interface code, make sure

LoadRunner can record correctly, that's a bit of a hassle. Many times, our interface pressure may indeed not be shown through the client side, it can only be done in the server using pure code form, either multi-threaded or repeated calls, but for testing

The collection of results is not so convenient. So we still have to make use of some of the advantages of tools, to take advantage of, for our use, LoadRunner Chart analysis is the best of all the tools, just it also supports Java code, C + + and other calling interface, which

Java as an example.

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

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

1. Package Java project files into jar format, for example, my project here is Logindemo, after packaging jar for 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 Create a new Java VUser script, first run Ha, see if the script is executed correctly, and save the file

4, the Logindemo.jar and Lib jar all import into the LoadRunner classpath, the premise is to ensure that the JDK file to be imported into LR, in the LR in the vuser--"Runtime settings, as shown;

   

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

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

1, in the introduction of the jar package, such as 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 is OK

2, the introduction of Java package files in the VUser, import method is incredibly occasional line occasionally not, so the choice package method is absolutely feasible

3, after VUser introduced Java package run may appear some error, basically is the jar file situation, as long as the LoadRunner classpath to find the basic no problem, there is the JDK must first import, otherwise it will directly prompt the process is terminated,

Cannot run Java file

4, LoadRunner for the introduction of Java files in a variety of ways, here the way to call the jar package 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 all of the Java class entire package folder to execute, which can take the time of the call, and the jar package to be called, or classpath to import.

As for the Java business logic implementation, can be implemented in Java, and then vuser directly call the method interface, indifferent can also be done in the VUser. Then you can set the number of virtual users in the scene to test the scene, and then according to the results of the scene test to score

The chart is basically the same as the other test methods after recording.

Copy to Google TranslateTranslation Results

LoadRunner calling Java programs-performance testing

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.