Overview
CI/CD pipelines, while often appearing as that singular term, are actually composed of two workflows. The first, Continuous Integration, is the process of integrating code into a mainline code base. Continuous Delivery is a bit more complicated; CD is a catchall for the many processes that deliver app changes to an app's user base after the code is integrated. Those processes involving testing, staging and deploying code.
Jenkins is a CI server that can assist your organization with its CI/CD pipeline goals. If your organization is using Jenkins as part of its DevOps testing workflow, you can easily incorporate it with your Kobiton experience. Kobiton is platform-agnostic and can be used with any CI/CD system, such as Jenkins, Testrail, and other similar systems that permit scripting - this document will cover how you can configure your Jenkins Automation Suite and Kobiton's Mobile Device Lab to give you a prime testing environment.
Prerequisites
- Desktop IDE, e.g., Eclipse, IntelliJ, Android Studio or Xcode
- A Cloud Repository account
- The ability to upload a project to the Cloud Repository, e.g., GitHub Desktop
- A Jenkins Instance and valid credentials
- Valid Kobiton login credentials.
Getting Started
You should have a previously known working project from your desktop IDE utilizing devices within your Kobiton Mobile Device Lab. This working baseline is important as it will assist with troubleshooting potential connectivity issues between Jenkins and the Kobiton Mobile Device Lab. If you have previously utilized the Scriptless Automation capability to export a Java-based Appium file, ensure that your username and API keys have been populated, like so:
There is no need to modify the existing desired capability for the selected devices.
Uploading your project to your Cloud Repository
For this example, we are using GitHub as our Cloud Repository example.
- Log into GitHub
- Create a New Repository
- Select a Repository Name and check to ensure that the repository is Public or Private. Also check that the repository initializes with a ReadMe File, and add a .gitignore and license model.
- Once the repository had been created, upload your project by either selecting the Upload File option or connecting with your GitHub Desktop application.
- Once the project files have been uploaded, note the URL of the current repository project, e.g. https://github.com/leslietannh/manual
Configuring Jenkins
- Within the Jenkins Dashboard, select New Item.
- Select the Maven Project to take advantage of the POM file that is included with the exported Appium File from Kobiton.The Configuration Screen will appear next.
Jenkins Configuration – General
- Enter a Description, if so desired.
- Select "Discard Old Builds". Determine your Log Rotation Strategy and fill in "Days to keep builds" and "Max # of builds to keep" fields. An example is shown below:
Jenkins Configuration – Source Code Management
- Select Git and provide the Repository URL (as mentioned previously) and your corresponding credentials.
Configuration – Build Triggers
- Select the appropriate build triggers depending on your requirement(s). In this example, the Build whenever a SNAPSHOT dependency is built as well as a Build Periodically – hourly triggers are selected.
Configuration - Build Environment
- Select the "Delete Workspace before build starts" option to enable Jenkins to request a code refresh from the Github repository.
- Select "Abort the build if it’s stuck".
- Select "Add timestamps to Console Output" if you would like timestamps to be included in every line of the output log of your test.
Configuration – Pre Steps; Build; Post Steps; Build Settings and Post-build Actions
Select Save or Apply to save your changes
Additional Configurations
- Optionally, if you wish to pass String Parameters to the Appium Code to use at run time as Environmental Variables, in the General Configuration, check “This Project is parameterized”.
- Select "String Parameters" from the dropdown list.
- Enter your Username Parameters (example below):
- Ensure the changes are reflected in the Config.java within the Github Repository.
Building a Project with Parameters
- Return to the Dashboard and select the new Project we’ve just created.
- Select “Build with Parameter”.
- Verify that the String Parameters are correct and click to Build. Validate the build is running by observing the Build History.
- To observe the Console Output, click on the Build # (2) and a drop down box will appear.
- Observe and validate that the Build has been started and the test is running.
You can also view the test running in Kobiton's platform concurrently with the feedback you receive from Jenkins by viewing the associated session in Kobiton: