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

Last updated: Jan 02, 2020 10:13

In the CI/CD pipeline, the application is deployed in HockeyApp when the application is built. The deployment of an application to different environments (Example: UAT/SIT) and platforms (Example: Android/IOS) is done on the Hockey Application. Moreover, HockeyApp maintains all versions that are uploaded for each platform and environment-specific applications.

The requirement is to always upload the latest version of the application in the Perfecto cloud repository before the execution starts. The driver will be configured with the same app path so the latest app will be downloaded and installed in the application before starting the script execution.

This section walks you through implementing an ISuiteListener of TestNG. To implement the code logic to upload HockeyApp to the Perfecto cloud repository, we will use the beforeSuite() method. The code logic contains all necessary API calls to figure out the HockeyApp download URL for the latest application version for the given application name. This Listener is integrated into the TestNG configuration file. Moreover, the required configuration parameters are configured as TestNG parameters.

On this page:

The following figure illustrates this solution architecture.


Pre-requisites

Integrating with HockeyApp requires the following:

  • The iOS and Android TestNG configurations need to be stored in individual files. It is a recommended practice to keep the Android CI/CD configuration and IOS CI/CD configuration separate.
  • cURL installed on the user system and the CI system, with the path configured in the system’s environment variable. (The solution must be able to download the Android files because the HockeyApp API response is not consistent for iOS and Android.)

Step-by-step instructions

  1. Download the HockeyAppListener.java file and add it in the package com.quantum.listeners.
  2. Register the listener in the TestNG configuration file, as shown in the following code snippet:

    <listeners>
    		<listener class-name="com.quantum.listeners.QuantumReportiumListener" />
    		<listener class-name="com.quantum.listeners.HockeyAppListener" />
    </listeners>
  3. Configure all required parameters in the testNG parameters as shown below. Please note that the parameters should be configured outside all test nodes.

    	<parameter name="downloadLatestHockeyApp" value="true" />
    	<parameter name="hockeyApp.name" value="<<HOCKEY_APP_NAME>>" />
    	<parameter name="app.upload.cloud.path" value="PUBLIC:Kulin/HockeyAppTest.ipa" />
    	<parameter name="hockeyAppToken" value="<<HOCKEY_APP_TOKEN>>" />
    	<parameter name="perfecto.capabilities.user" value="kulins@perfectomobile.com" />
    	<parameter name="perfecto.capabilities.password" value="<<CLOUD_PASSWORD>>" />
    	<parameter name="driver.capabilities.app" value="PUBLIC:Kulin/HockeyAppTest.ipa" />
    
    	<test name="IOS Calc Test" enabled="true">

    Where:

    • downloadLatestHockeyApp is the flag to decide whether the latest HockeyApp is to be downloaded or not.

    • hockeyApp.name is the name of the Application displayed on the main screen of the HockeyApp.

    • app.upload.cloud.path is the path in the perfecto cloud repository where the application file is to be uploaded.

    • hockeyAppToken is the Requests that require authentication need to set the HTTP header X-HockeyAppToken to a valid API token. Each user can create multiple tokens under API Tokens in the account menu.

    • perfecto.capabilities.user is the Perfecto cloud user name. You can also use the ‘driver.capabilities.user’ key in case you are working with multiple different driver names.

    • perfecto.capabilities.password is the Perfecto cloud password. You can also use the ‘driver.capabilities.password’ key in case you are working with multiple different driver names. Known Limitation: This solution will not work with the securityToken key as the CloudUtils.uploadMedia() function is currently limited to a password only. (Should be fixed in one of the upcoming Quantum versions.)

    • driver.capabilities.app is the path in the Perfecto cloud repository where the application file is to be uploaded.

    Note: The app.upload.cloud.path & driver.capabilities.app parameters are configured with the same path.