Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Jan 08, 2020 13:37

This section walks you through integrating Perfecto Appium and Selenium scripts with Micro Focus LoadRunner. A sample LoadRunner project, including .jar files for all dependencies and a sample script, is available here: https://github.com/PerfectoMobileSA/LoadRunnerSample

Prerequisites

The integration with LoadRunner requires:

The complete solution is available here: https://github.com/PerfectoMobileSA/LoadRunnerSample

On this page:

1 | Create a Perfecto script in Virtual User Generator

  1. Open the Virtual User Generator.
  2. Create a new script:
    1. In the Create a New Script dialog, select Java Vuser. If you have provided the correct dependencies, this allows you to run any .java script.

       Click to view image
    2. Click Create.
      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
  3. Test the script, as follows:
  4. Click the run button  to test the script. If the script passes, continue with step 5.
  5. If any compile errors occur, most likely your JDK is not set up correctly. In this case, do the following:
    1. In the Solution Explorer, select Runtime Settings.
    2. 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
    3. Click the run button  again.
  6. Open the sample script and copy its content.

  7. 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:

    • Pairing lr.start_transaction("Transaction_Name"); with lr.end_transaction("Trnasaction_Name", lr.AUTO);
    • (Recommended) Using method uxTimer:

      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.

  8. Add the Selenium and Appium dependencies, as follows:
    1. On the Runtime Settings tab, add the .jar files that contain all the dependencies.

       Click to view image
    2. 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

  1. Open LoadRunner Controller and import the script you created.

  2. Modify the settings as needed and click the run button at the top left.
  3. When the run is complete, click Results > Analyze Results.
  4. In the LoadRunner Analysis Summary, view the transactions displayed.