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

Last updated: Sep 09, 2020 10:32

The Perfecto Jenkins plugin provides the ability to auto-create or re-use an existing Perfecto Connect tunnel ID in the build environment.


Before you enable the plugin, make sure you:

  • Download the Perfecto Connect client and extract it to any folder.
  • Generate a Perfecto security token (if you do not have one already).
  • Install Jenkins via brew if you are a Mac user.
  • Perform the following steps as an administrator of the Jenkins environment:
    1. In Jenkins, in the Manage Jenkins > Manage Plugins view, select the Available tab.
    2. In the search field, enter perfecto to search for the Perfecto plugin. 
    3. To the left of the Perfecto plugin, select the checkbox. Then click Install without restart.

On this page:

 Click to view image

Step-by-step instructions

Watch this short video to see a demo of the plugin configuration. Detailed steps follow.

1 | Enable the Jenkins plugin

Perform the following steps to enable the plugin in Jenkins.

To enable the plugin:

  1. On the Jenkins homepage, in the left pane, click New Item.

  2. In the Enter an item name field, specify the name for your new item.
  3. Select any project type except pipeline.
  4. Click OK.
  5. Under Build Environment, do the following:

    Note: Get help from your Jenkins Administrator to create the Perfecto credentials, as covered in steps 5a-d.

     Click to view image for Mac
     Click to view image for Windows

    1. Select the Perfecto Connect checkbox.
    2. Next to the Credentials list, click Add and then select Jenkins.
    3. In the Add Credentials form, do the following: 

       Click to view image
      1. From the Kind list, select Perfecto.
      2. Provide your cloud name, username, and Perfecto security token.
      3. Click Add.
    4. From the Credentials list, select the credentials you added.
    5. In the Perfecto Connect Path field, provide the path to Perfecto Connect, such as /Users/Mymac/Downloads on Mac.
    6. In the Perfecto Connect File Name field, provide the file name of the Perfecto Connect executable, such as perfectoconnect on Mac or perfectoconnect64.exe or perfectoconnect32.exe on Windows.
    7. (Optional) Click Advanced to set advanced Perfecto Connect configuration options, as follows:

       Click to view image

      • In the Additional Parameters field, provide additional Perfecto Connect parameters, such as bridgeproxyip and bridgeproxyport. For example:

        - --bridgeproxyip= --bridgeproxyport=8888

        For more information, see Work with Perfecto Connect.

      • To override the name of the Tunnel ID environment variable, in the Override Tunnel ID Name field, provide a different name.
      • To reuse a Tunnel ID already created earlier, in the Existing Tunnel ID field, provide the existing ID.

2 | Use the Jenkins plugin in Selenium/Appium (usage samples)

This section illustrates how to connect to Perfecto Connect with Maven and Gradle.

Connect with Maven

The following image shows how you can connect to Perfecto Connect with Maven.

Connect with Gradle

The following image shows how you can connect to Perfecto Connect with Gradle.

3 | Stop Perfecto Connect

  1. Under Post-build Actions, add a post-build task.
  2. In the Script field, enter the following script:

    /<path to Perfecto Connect>/<name of Perfecto Connect executable> stop

    For example:

    On Mac
    /Users/mymac/Downloads/perfectoconnect stop
    On Windows
    C:\Users\Administrator\Downloads\perfectoconnect64.exe stop
     Click to view image

4 | Work with advanced usage scenarios

This section covers independent and alternate practices you may want to use in combination with the Jenkins plugin, in particular how to create a Jenkins pipeline with Perfecto Connect and how to upload a file to the Perfecto media repository.

Create a Perfecto Connect pipeline

  1. Create a new pipeline and add the below code to the Pipeline Script field:

    import javax.swing.GroupLayout.ParallelGroup
    import groovy.json.JsonSlurperClassic
    import groovy.json.JsonSlurper
    node {
    String cloudName = "<<CLOUD NAME e.g. demo>>";
    String securityToken = "<<SECURITY TOKEN>>";
    String perfectoConnectPath = "/Users/myMac/Downloads/perfectoconnect";
        environment {
            tunnelId = ""
        stage('perfectoconnect start'){
                 error "Kindly update cloudName, securityToken and perfectoConnectPath"
            String script = perfectoConnectPath + " start  -c " + cloudName + "  -s " + securityToken;
            echo script;
            tunnelId = sh (script: script , returnStdout: true).trim()
            env.tunnelId = "${tunnelId}"
            echo "Tunnel id: ${tunnelId}"
        stage('perfectoconnect stop'){
            sh label: '', returnStdout: true, script: perfectoConnectPath + " stop"
  2. In the script, update the cloudName, securityToken, and perfectoConnectPath as applicable.

Upload the app to Perfecto

To upload the app to the Perfecto media repository using cURL, see Upload a file to the repository via API using Postman or cURL.