Software Test Tool LoadRunner invoke Java class

Source: Internet
Author: User

Recently, the company needs to test several functional classes of performance, although I think this is the scope of the white box test, but the leadership required to do so, I will have to conduct technical research. The requirement is to be able to pass parameters to the class, and can receive the parameters returned by the class, and make the correct judgment.

The first step, the general idea.

I used to use LoadRunner directly to record, but some of the protocols are really difficult to do not know how to record, like Vb,c++,java language to do things I think the simplest way is to directly call the relevant class file, dynamic link library, directly in the way of the code to invoke. In this thought, I tried to write a program in LoadRunner to invoke the Java class.

The second step is to do the Java classes that meet the requirements of the experiment.

To tell the truth, it's too difficult for me, I do not understand Java, but I know C + +, but the Java code writing and compiling environment, are I have never seen. Slowly learn, ask a lot, not easy to get the first level of these, first to install J2SDK under the system disk. , and then add the%java_home%\bin to the system environment variable, you can use the cmd command to compile and run the Java operation. The commands compiled and run are the running Javac Test.java and Java test parameters in your Java class directory, for example, if your class is in the C:\Test directory, you should use CD \test in cmd, go to this directory, and then use Javac The Test.java and Java test parameters are manipulated.

I found an out-of-the-box Java class from the Internet, now put the source code below.

package MAIN;
import java.io.PrintStream;
public class Birthday
{
public String year;
public String month;
public String day;
public Birthday()
{
year="1900";
month="01";
day="01";
}
public Birthday(String y,String m,String d)
{
year=y;
month=m;
day=d;
System.out.println("OK");
}

public String getBirthday()
{
String fullbirthday=month+'/'+'/'+day+'/'+year;
return fullbirthday;
}
}

Class is simple, and compiling with the above method is easy to get through.

Related Article

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.