Last updated: Jan 08, 2020 13:37
1 | Create a Perfecto script in Virtual User Generator
- Open the Virtual User Generator.
- Create a new script:
In the Create a New Script dialog, select Java Vuser. If you have provided the correct dependencies, this allows you to run any
On the Actions.java tab that opens, you should see the class populated with some stubs. In our case, we want to put all our Selenium/Appium code in
action().Click to view image
- Test the script, as follows:
- Click the run button to test the script. If the script passes, continue with step 5.
- If any compile errors occur, most likely your JDK is not set up correctly. In this case, do the following:
- In the Solution Explorer, select Runtime Settings.
On the Runtime Settings tab, provide the path to your 32-bit JDK (Java Environment > Java VM > Use the specified SDK).Click to view image
- Click the run button again.
Open the sample script and copy its content.
On the Actions.java tab, paste the content of the sample script to replace the existing content.A word on imported packages
import lrapi.lr; - Loadrunner method that allows you to add transaction timers. This is critical to having the logical steps added in the LoadRunner report. Example:
You can add transactions to LoadRunner by doing any of the following:
- (Recommended) Using method
This grabs the UX timer from the Perfecto API and utilizes
lr.set_transaction(timerName, timeEx, lr.PASS);to input a transaction in LoadRunner.
This adds a transaction entry in the LR report.
- Add the Selenium and Appium dependencies, as follows:
On the Runtime Settings tab, add the
.jarfiles that contain all the dependencies.Click to view image
Save the script and run it again.Click to view image
It should open the Perfecto UI to show the test run in the Test Analysis view.Click to view image
When done, you should see the "Script Passed" message.
2 | Run a Perfecto script in LoadRunner Controller
Open LoadRunner Controller and import the script you created.
- Modify the settings as needed and click the run button at the top left.
- When the run is complete, click Results > Analyze Results.
- In the LoadRunner Analysis Summary, view the transactions displayed.