Travis CI
  • 11 Oct 2023
  • 3 Minutes to read
  • Dark
    Light

Travis CI

  • Dark
    Light

Article summary

Overview

Travis CI is a cloud-based service that offers continuous integration to test and build software projects, which can be hosted on various platforms such as GitHub, Bitbucket, GitLab, Perforce, Apache Subversion, and Assembla. The service offers a free trial plan that includes 10,000 build credits, allowing users to test it on public and private repositories without any charge. Additionally, there are no restrictions on the number of users that can utilize this plan.

pCloudy has been integrated with Travis CI so that every commit is automatically passed through the automated pipeline before it is pushed to the relevant feature branch. With pCloudy, you can carry out automated testing of your Native and Web applications, ensuring that your development code functions seamlessly across a comprehensive online Appium grid comprising over 5000 device-browser combinations that operate on the cloud.

Prerequisites

In order to conduct Mocha tests using pCloudy, you must have the following prerequisites in place:

Global Dependencies

  • A Git or GitHub repository
    You must first download and install node.js and node package manager or npm. For installation of node.js using homebrew, execute the given command in your terminal:
$ brew install node 

In case you already have npm installed, it is advisable to update it to the most recent version. You can do this by running the following command in your terminal:

$ npm install npm@latest -g

Integrating pCloudy With Travis CI

To incorporate pCloudy with Travis CI, you must include the configuration file .travisci.yml in your root directory of your feature branch on GitHub, and specify all the required configurations to conduct the tests. With every commit, Travis CI will execute the build (#.travisci.yml), while simultaneously running the test on pCloudy My Active Sessions.
It is essential to set up your repository with Travis CI to enable the running of build steps.

Below is the sample config file for Integration with Mocha :

.travisci.yml this directory should be added in the root directory of of the branch
And below is the content for .travisci.yml

# Specify the operating system to be used during the build process
os:
  - linux

# Choose the specific version of Ubuntu to use as the base image
dist: focal

# Specify the programming language to be used
language: node_js

# Choose the desired version of Node.js
node_js:
  - "20"

# Specify the commands to be executed during the build process
script:
  # Install dependencies with npm
  - npm install
  # Run the "android" script
  - npm run android

The given code shows the desired capabilities needed to execute the Sample-test.

capabilities = {
        "browserName": "",
        "pCloudy_Username": "Enter-Email",
        "pCloudy_ApiKey": "Enter API-Key",
        "pCloudy_ApplicationName": "pCloudyAppiumDemo.apk",
        "pCloudy_DurationInMinutes": "10",
        "pCloudy_DeviceFullName": "GOOGLE_Pixel2XL_Android_11.0.0_d22ac",
        "platformName": "Android",
        "automationName": "uiautomator2",
        "newCommandTimeout": "600",
        "launchTimeout": "90000",
        "appPackage": "com.pcloudy.appiumdemo",
        "appActivity": "com.ba.mobile.LaunchActivity",
        "pCloudy_EnableVideo" : "true", # optional
    };

The "pCloudy_Username" and "pCloudy_ApiKey" fields can be customized as per the user's credentials.

Parallel Test

Use the parallel-Test-code to run the parallel test build . Once you have done this, you will need to specify the desired capabilities required to execute the Sample-test.

commonCapabilities: {
              browserName: "",
              pCloudy_Username:"Enter-Email",
              pCloudy_ApiKey: "Enter API KEY",
              pCloudy_ApplicationName: "pCloudyAppiumDemo.apk",
              pCloudy_DurationInMinutes: "10",
              platformName: "Android",
              automationName: "uiautomator2",
              newCommandTimeout: "600",
              launchTimeout : "90000",
              appPackage: "com.pcloudy.appiumdemo",
              appActivity: "com.ba.mobile.LaunchActivity",
              pCloudy_EnableVideo : "true",
        },
        multiCapabilities: [
          {
              "pCloudy_DeviceFullName": "GOOGLE_Pixel7Pro_Android_13.0.0_dbf82",
          },
          {
              "pCloudy_DeviceFullName": "MOTOROLA_Edge30Ultra_Android_12.0.0_15b11",
          }

The commonCapabilities field contains properties such as browserName, pCloudy_Username, and pCloudy_ApiKey, which need to be customized as per your credentials. In the multiCapabilities field, you can add as many devices as you require by specifying the pCloudy_DeviceFullName property for each device. This will enable you to execute the Sample-test on multiple device-browser combinations in parallel, leveraging the benefits of pCloudy's cloud-based testing infrastructure.


Was this article helpful?

What's Next