Load Testing in a Continuous Integration Environment with Selenium and Jenkins

Load Testing in a Continuous Integration Environment with Selenium and Jenkins

In this blog post, we will talk about Load Testing in a Continuous Integration Environment and how to effectively integrate with cloud systems using RedLine13. The crucial point of the this blog post is that we are preparing our load test script just using Selenium code. Before we begin our example, let’s briefly talk about the technologies used in Continuous Integration (CI) processes in our post.

Jenkins is an open source automation server and an integration tool developed with Java. It is able to help automate parts of the software development process. Jenkins allows developers to quickly find, solve, and automate testing flaws in code.

Selenium is a open source test automation framework. It is the most widely used and most popular test automation framework in the industry.

RedLine13 provides a plugin so you can easily integrate your load test scripts with your Continuous Integration / Continuous Development (CI/CD) process flow. You can easily set up the plugin on your Jenkins server following our previous post.

Steps for Load Testing in a Continuous Integration Environment

First we will write a Selenium script. Later we will run this script on the cloud using RedLine13. And finally we will create a Jenkins job and run your load test script on your local CI/CD server.

Let’s start by preparing the simple login Selenium script using RedLine13 library. As you see below, if you’re familiar with Selenium, that means you can easily prepare the load test script and execute it in the cloud.

simple login Selenium script

After completing the script, it is good practice to verify whether the script works or not. The easy way is to run it locally with the following command:

“node JenkinsSelenium.js”

verify whether the script works

After verifying that the script works, we are ready to execute the test on the cloud via RedLine13.

Click on the “Start Testing” button and for the Test Type choose “Custom Test”.

Screenshot for choosing Custom Test

Upload your Selenium script which we prepared above.

Upload your Selenium script

Later, choose the AWS Load Agents to execute your script in the cloud.

choose the AWS Load Agents

To execute the Selenium tests on RedLine13, configure your test plan as below:

To execute the Selenium tests on RedLine13, configure your test plan

After the completing the configuration, you are ready to start the test. Click on the “Start Test” button.

After the successfully completing the script, there will be a button “Save For Jenkins”

In your test view, this new Test Plan will be blue and represents a Jenkins template.

this new Test Plan will be blue and represents a Jenkins template.

Now we have created the Jenkins Job. Give it a name and save.

we have created the Jenkins Job. Give it a name and save.

Next step is to “Add Post-Build Action ‘RedLine13″ button. As you see below, on our Jenkins Server we can see our previous RedLine13 scripts.

We select the script on the dropdown list.

select the script on the dropdown list.

Save your job and click on “Build Now” to start the job.

Watch the console output and you can see that our load test succeeded! We have done Load Testing in a Continuous Integration Environment.

console output - Load Testing in a Continuous Integration Environment.