Using Jenkins and Jmeter to build a scalable Load Testing solution

Post on 25-Jan-2017

1.048 views 1 download

Transcript of Using Jenkins and Jmeter to build a scalable Load Testing solution

Hier soll der Titel reinNon-Functional Testing

www.qs-tag.de

Organizer: imbus AG www.qs-tag.de

Using Jenkins and Jmeter to build a scalable Load Testing solution

Ruslan StrazhnykCipherHealth LLC

About me

• Ruslan Strazhnyk – Lviv(Lemberg), Ukraine

– Rich experience in creating and supporting Test Automation Frameworks and infrastructure – Front-end, Back-end, API, Performance Testing

– Languages: Ruby, Python, Java, JS– Experience with cloud services– Technologies: Selenium, REST, Jenkins, JMeter,

Openstack

Where I work

https://cipherhealth.com/

Agenda

• Jmeter. Test Recording and Playback.

• Composing Jmeter maven project for Jenkins. Upload to Github.

• Tuning Jenkins and executing the build.

• Results Analysis

Load Testing

Performance Testing tools

What tools have you used for Performance-Testing?

What parameters were you measuring?

What was your most complex scenario?

Performance Testing Classic Scheme

• Identify Test Environment

• Identify Performance Acceptance Criteria

• Plan and Design Tests

• Configure Test Environment

• Implement Test Design

• Execute Test

• Analyze Results

JMeter

• HTTP(S) coverage• REST coverage• Portability and 100% Java purity• Full multi-threading ability• GUI designed for Composing Test

Plans/Debug• Data visualization plug-ins• Unlimited testing capabilities using plug-ins

JMeter

JMeter Test Recording Demo

Prepare Jmeter test for non-UI mode.

• Download JMeter from official page.• Unzip it to specified folder.• Download JMeterPlugins-standard from

additional Plug-ins page. • Extract archive contents to JMeter installation

directory.• Restart Jmeter to be able to add new plug-

ins.

Prepare Jmeter test for integration.

Now add these Listeners to the test plan Right-click via Add > Listener• jp@gc – Console Status Logger• jp@gc – Active Threads Over Time• jp@gc – Response Over Time• jp@gc – Transactions per Second• View Results Tree

Prepare Jmeter test for integration.

Set these options in Thread Group, this would be used by maven later

Maven

Yiddish word meaning accumulator of knowledge

Maven’s Objectives:• Making the build process easy• Providing a uniform building system• Providing quality project information• Providing guidelines for best practices• Allowing transparent migration to new features

Maven plug-ins used:• clean – cleans after the build• compiler – compiles Java sources• install – install built artifact into local repository• more plugins - https://maven.apache.org/plugins/index.html

Preparing Maven project

JMeter tests are integrated into a maven build and automatically generate graphs from the test results using the jmeter plugin CMDRunner.

“jmeter-maven-plugin” is used to integrate jmeter in the maven build. To generate graphs from the jmeter results, the “jmeter-graph-maven-plugin” is used.

Preparing Maven projectMaven config file pom.xml is already parameterized

for Jenkins build

Jmeter tests are simply stored in the directory /src/test/jmeter

Maven

Preparing maven project Demo

Jenkins

• Pre-installed Jenkins VM (Ubuntu 14.04)• What’s in pre-configured VM:

– Installed Java-JRE for maven and Jenkins– Installed maven 3.3, github, vim– Configured Github account– Installed Intellij Idea

• Install additional JMeter-Performance plug-in and GitHub plug-in

Build Jenkins job

• Set parameterization values– THREAD COUNT– LOOP COUNT

• Set Github repository• Set build trigger (SNAPSHOT dependancy)• Set build step

– Root POM– Goals and options

• Publish Performance Test Result report

Jenkins Performance plugin• allows you to capture reports from JMeter and JUnit . • Jenkins will generate graphic charts with the trend report of

performance and robustness.• it includes the feature of setting the final build status as good,

unstable or failed, based on the reported error percentage.• https://wiki.jenkins-ci.org/display/JENKINS/Performance+Plugin

HTML Report Auto-generation

HTML Report Auto-generation

Basic graphs are already generated with html

jmeter-graph-maven-plugin

Batteries Included: Ability to Generate More Graphs

How to add new graph

Batteries Included: Ability to Generate More Graphs

With the simple manipulation, it is possible to generate up to 11 Graphical Metrics for different KPI’s

Response Times Distribution

This graph will display the response time distribution of the test. The X axis shows the response times grouped by interval, and the Y axis the number of samples which are contained in each interval.

Response Codes per second

This graph will display the response code per second returned during the test.

More beautiful graphshttp://jmeter-plugins.org/wiki/Start/

What’s next?

Generate pom.xml files for the project with Rubyhttp://www.nokogiri.org/

Ruby-jmeter – generate jmx scenario programaticallyhttps://github.com/flood-io/ruby-jmeter

Summary

• Up-sides:– Building working solution from OpenSource

components (no license payment, fees etc.)– Full customization– Integration capabilities

• Down-sides:– Experience needed to set-up and work with it– Needs dive-in to maven to be able to customize

builds

External Resources

• Jmeter http://jmeter.apache.org/• Jmeter plug-ins http://jmeter-plugins.org• Jenkins http://jenkins-ci.org• https://maven.apache.org/guides/introduction/introduction-to-t

he-pom.html

• https://lincolnloop.com/blog/load-testing-jmeter-part-1-getting-started/

• https://wiki.opendaylight.org/view/Install_On_Ubuntu_14.04• https://www.ubik-ingenierie.com/blog/automatically-

generating-nice-graphs-at-end-of-your-load-test-with-apache-jmeter-and-jmeter-plugins/

• https://github.com/smarigowda/jmeter-maven-example

Questions and Answers

My contactsSkype - ruslanstrazhnykTwitter - @strazhnykE-mail – strazhnyk@gmail.com