When you create a new Java VUser with LoadRunner, the automatically generated action class references the "LRAPI.LR" package. The class file for this package is located under "LoadRunner root directory/classes/lrapi". Using these class files to generate the jar package, you can reference it in the Java project and write the LoadRunner script directly in Eclipse.
To generate the jar package process:
Create a new project in 1,eclipse, name Lrapi.
The Lrapi folder in the 2,loadrunner installation directory is copied to the root of the project you built in the previous step and refreshed in eclipse:
3. Export the jar package from Eclipse and click File-export-java (javafile). When selecting resources, just tick the Lrapi folder. The file name is Lrapi.jar. All the way next.
4, used in the introduction of the project:
PackageDEFAULTPK;/** LoadRunner Java script. (Build: _build_number_) * * Script Description: **/ ImportLRAPI.LR; Public classactions{ Public intInit ()throwsThrowable {return0; }//End of Init Public intAction ()throwsthrowable {lr.start_transaction (NULL); System.out.println ("This was a test for Lrapi.jar"); Lr.end_transaction (NULL, 0); return0; }//End of Action Public intEnd ()throwsThrowable {return0; }//End of End}
Using Eclipse to lead the LoadRunner API into a jar package