Continuous Performance Testing — Building a project

Badri Narayanan Sugavanam
3 min readOct 16, 2018

--

“people paddling on sea” by Quino Al on Unsplash

The performance and load tests usually are done aftermath or at the tail end of a software development life cycle. Finding a metric which is not satisfactory puts the release on hold and puts the engineering team on a hot seat. It might be a fix done which calls for a revamp of the backend layer or include to employ a new cache tactic. These issues are usually hard to fix and puts unnecessary pressure on both the developer and tester.

Integrating the performance tests as a downstream job to the development pipeline combines performance testing in every build. I will share my story on how I went on about configuring a downstream job in Jenkins, which would trigger a continuous performance test jobs.

Firstly to make JMeter script run continuously. The tests need to download the JMeter at runtime. I want the scripts to have the ability to control the thread count. Since executing the JMeter from the GUI require manual intervention. The tests should be executed in headless mode. The settings such as the thread count and the execution time should be passed onto to the test at the test execution time. The parameters which hit my mind are the Thread count and test duration.

Downloading the dependent libraries required for a project and execute them are some basic features provided by Maven. Maven is a project management tool. It is possible to pass the custom parameters to any maven project at runtime. Thus I ended up choosing maven for project management for this performance and load tests.

The starting point is to create a Project Object Model. It is an XML file detailing everything about the project.

The mandatory items to identify a project are

  • groupId
  • artifactId
  • version

I have a MacBook, and I can install maven from the terminal as follows:

Open terminal and type as follows. It will install maven to create the required POM file.

Installing Maven via Home Brew

If you have a windows machine follow this article to setup maven.

To create a maven pom file type

Create a Maven POM file

You should be seeing a Maven POM file similar to the one below

The above POM file is used throughout this discussion. In the above POM file have you note the use of the jmeter-maven-plugin. The jmeter-maven-plugin is a build plugin. It means you need to configure this plugin within <build>tags. Follow as per the above code as shown in the <plugin>. In particular notice at the <execution>block, both the properties such as <id> and <goal> are mandatory for the jmeter-maven-plugin configuration.

The plugin requires the test should be present at ${project.base.directory}/src/test/jmeter. During the test execution, it copies all the JMX files and the configuration from ${project.base.directory}/src/test/jmeter and all the subdirectories to a flattened and the directory path will be used to create a file name under ${project.build.directory}/jmeter/testFiles

To execute the test open terminal and type from the ${project.base.directory}

Trigger test

In the next series of this blog. I will share the details on how to configure the above build as a Jenkins job. The job would execute in an ephemeral docker slave. In the concluding blog, we would have details on how to develop a continuous monitoring dashboard with grafana.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response