Last updated: Sep 09, 2020 10:32
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:
On the Jenkins homepage, in the left pane, click New Item.
- In the Enter an item name field, specify the name for your new item.
- Select any project type except pipeline.
- Click OK.
Under Build Environment, do the following:
- Select the Perfecto Connect checkbox.
- Next to the Credentials list, click Add and then select Jenkins.
In the Add Credentials form, do the following:
- From the Kind list, select Perfecto.
- Provide your cloud name, username, and Perfecto security token.
- Click Add.
- From the Credentials list, select the credentials you added.
- In the Perfecto Connect Path field, provide the path to Perfecto Connect, such as
/Users/Mymac/Downloads
on Mac. - In the Perfecto Connect File Name field, provide the file name of the Perfecto Connect executable, such as
perfectoconnect
on Mac orperfectoconnect64.exe
orperfectoconnect32.exe
on Windows. (Optional) Click Advanced to set advanced Perfecto Connect configuration options, as follows:
In the Additional Parameters field, provide additional Perfecto Connect parameters, such as
bridgeproxyip
andbridgeproxyport
. For example:- --bridgeproxyip=127.0.0.1 --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
- Under Post-build Actions, add a post-build task.
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 WindowsC:\Users\Administrator\Downloads\perfectoconnect64.exe stop
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
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'){ if(cloudName.contains("<<")){ error "Kindly update cloudName, securityToken and perfectoConnectPath" } String script = perfectoConnectPath + " start -c " + cloudName + ".perfectomobile.com -s " + securityToken; echo script; tunnelId = sh (script: script , returnStdout: true).trim() env.tunnelId = "${tunnelId}" } stage('script'){ echo "Tunnel id: ${tunnelId}" } stage('perfectoconnect stop'){ sh label: '', returnStdout: true, script: perfectoConnectPath + " stop" } }
- In the script, update the
cloudName
,securityToken
, andperfectoConnectPath
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.