This post is from the Experitest blog and has not been updated since the original publish date.
Turbo Boost Your Digital App Test Automation with Jenkins
Digitization is not just a good marketing strategy these days, it is a sound business strategy too. For businesses to stay relevant, they need to be digitally accessible. Digital assets provide a means for customers to get in touch with your market offerings. If we look at it from a marketing standpoint, digitization is a bridge between your company offerings and your customers. It plays both the functions of place and promotion -- two of the four important Ps of Marketing Mix. It also plays directly into your digital app test automation. More on that in a bit.
Summed up briefly, having functional, customer-focused digital resources means increasing your chances of online success. Mobile and web applications are at the core of the digital ecosystem.
Digital transformation is closely linked with your business priorities which, according to Forrester research, can be realized in the form of better customer experience or increased revenue growth. The increasing focus on digitization requires software and application development companies to get up to speed with the evolving market landscape. Customers expect high-quality products and shorter released cycles. This triggers paradigm shifts in DevOps approaches and software development life cycles (SDLCs). Forward-looking software and application development companies have already invested in digiral app test automation tools and infrastructures. This makes their development cycles leaner and more agile. With DevOps and CI/CD practices, they are able to shorten release cycles and improve quality. It then becomes easier to channel valuable resources towards other, more resource demanding areas of businesses.
Changing Digital Landscape
With growing digital consumption comes the need for growing digital segmentations. From device platforms to operating systems to mobile device vendors and browsers, the segmentations are only growing. From a testing standpoint, this means more work and a growing concern for quality within development environments. It is going to be all the more challenging for companies to handle the growing demand and expectations for high-quality applications. This is exactly why modern dev-test approaches are becoming imperative to help shorten release cycles and maintain product quality.
With agile, DevOps, and CI/CD practices, companies are now able to achieve efficiency, synergy, and better product quality simultaneously. Continuous integration and continuous testing enable testers to execute tests at scale and overcome bottleneck issues effectively. These practices, coupled with rapid result analysis and reporting, truly enable companies to launch products more frequently and measure up to the expectations of digital customers.
The Dev-test Process
The dev-test process is basically a reflection of the organizational synergy within a high-paced development environment. It seamlessly merges people and processes to achieve perfect coordination and efficiency. With increased coordination, the team members are able to smooth the cycle and address problems when and where they occur. From product owners to product analysts to testers and dev engineers, everyone is aware of how things are progressing and which stage a release candidate is getting to. Since it's a continuous cycle, it establishes a safety net to help them avoid any potential failures or malfunctions with minimal time wasted.
Digital App Test Automation
Mobile and web apps are at the heart of digital transformation. To deliver quality apps at scale, technology companies need to incorporate continuous testing into their development processes. Digital app test automation frameworks such as Appium and server-based CI systems such as Jenkins are the most credible automation frameworks for use with apps. The SeeTest Continuous Testing Platform leverages these frameworks to allow developers and testers to efficiently set up, create, run, report, and manage their automated tests. The process of continuous testing for digital apps runs in the following manner:
Developers and test engineers commit app code and tests into the GitHub repository. As soon as the codes and tests are committed, GitHub takes over and performs the following actions:
- Pulls up the app and test sources
- Triggers CI tools (such as Jenkins) to start building the app and test project
The CI/CD tools are core to the entire process of building and testing digital applications. With Jenkins, for example, you can automate all sorts of tasks related to building, testing, and deploying digital applications, saving you time and giving you more control over the process.
To get a better understanding of how Jenkins is configured with SeeTest, you can refer to our previous webinar where our Senior Sales Engineer, Jonathan Aharon, has provided a complete demo of how it all works. Below, we will quickly go over the process and mention the steps you can follow to configure Jenkins and perform automated tests utilizing our Experitest platform resources.
1) Create and configure automation GIT repositories
To integrate SeeTest digital app test automation with Jenkins, we need to begin writing a test using Appium Studio for Eclipse. Since we are using Maven for our demo, we will need to look into the pom.xml file first and specify the configuration information. Maven manages and specifies our dependences inside Eclipse, including JUnit and Appium frameworks, and allows us to download all the resources we need to proceed with Jenkins integration.
Once we are done creating a test using Appium studio for Eclipse, we can upload it to GitHub and head on to Jenkins configuration as the next step of the process.
2) Configure Required Plugins in Jenkins
Before we create a job in Jenkins for our test, we need to configure the required plugins. These drivers include the following:
- Maven integration plugin to create Maven projects easily and quickly
- Multijob plugin to help run all jobs concurrently
- Git plugin to connect Jenkins environment with GitHub and download the code for use in the test
- Rich Text Publisher plugin to publish rich text messages in Jenkins
3) Create A Jenkins Job
Once we make sure that all the above plugins are installed under the installed tab within Jenkins, we can proceed by creating a new job within Jenkins (for the Android test in our demo case).
Clicking on New Job will take us to a page where we can give it a name. Since we'll have the Maven integration plugin installed, we can select the Maven project from the given options. Within the Maven project, we have all of the configurations that we need to change in order to set up the job.
4) Configure Environment Variables
Once the page opens, we can add parameters to the job. We then name them according to the environment variables used in the code. The environment variable we use in the code actually pulls the information from the corresponding parameters in Jenkins. In the demo, we have used a deviceQuery parameter to instruct Jenkins to pull the device we want for our test.
Once this process is done, it's time to connect with GitHub. Go to Source Code Management, select Git and add the URL which can be pulled from the GitHub repository.
Next thing is to create Pre Step with a windows batch command (if you're using Windows). With Pre Step, we basically upload our app to the Digital Assurance Lab on Experitest platform. To upload the app, we use the Rest API with a simple post request along with the APK file. To ensure that we are only uploading the exact version of the file we had uploaded on GitHub, we will need to insert some commands in the Command Box under Pre Steps. With command Box, we can set up specific variables like base URL to the cloud, application link, access key, build number, a header for authentication, and files location for our test.
Maven, by default, considers all the tests it finds while running. To ensure we only run a specific test, we will need to set up a build that specifies our target test. In the Build section of the Pre Step, we have the Goals and Options box. Here we can input a command to specify the class name of the test that we need to run.
Lastly, we need to apply some Post-build Action commands to enable publishing a link to the report URL. Through adding a rich text message, we set up the reporter with a Build Number which yields the specific report we want to see for our test.
That's all we need to configure in Jenkins to enable hands-free execution and report collection for a single job. However, more often than not, we are required to create a few more of these jobs. That action will allow us to run all tests in parallel. Fortunately, we don't have to set everything up from scratch. The only difference between the jobs, within Jenkins, is going to be the deviceQuery parameter. We need to open the Multijob Plugin and tweak this parameter for each item on the list of jobs that we would like to run concurrently.
That's about it. Now we will be able to see all these tests in the Grid View execution panel of Experitest cloud. We can also see the report from within the cloud's UI and learn what happened with the test. But it's more convenient and easy to see it all in one place, within Jenkins itself. To view the report for a specific job, you just need to select that job within Jenkins. You can then open the report link to see all the passed/failed tests along with thumbnails and screenshots of the process. The report is assertive and indicates exactly where and how the tests failed (in case of failures.
Building great apps at scale with the help of Jenkins is no longer a challenge. Within Jenkins, you can find hundreds of plugins to support your build. These plugins will also automate any testing project with ease and efficiency. SeeTest is literally your "one-size-fits-all" tool for application testing. It is built on leading open source automation frameworks like Appium and Selenium and continuous integration environments like Jenkins and Bamboo. Additionally, You can integrate SeeTest digital app test automation into any IDE, testing framework, and CI environment to help you achieve unprecedented levels of efficiency and productivity.