serputko / performance-testing-framework

Framework allows to perform load testing with Apache Jmeter, view application/server metrics in real-time with Grafana, analyze errors cause with detailed traces for failed requests, compare different test runs in scripted dashboard and perform frontend performance testing with sitespeed.io+webpagetest
Apache License 2.0
404 stars 209 forks source link
backend-load-testing docker frontend-load-testing grafana influxdb jenkins jmeter load-testing load-tests performance performance-measurement performance-testing real-time-monitoring sitespeed sitespeedio telegraf webpagetest webpagetest-agent webpagetest-server

Performance testing framework

This framework could be used both for backend load testing with Apache Jmeter and frontend load test with sitespeed.io + webpagetest private instance.

Custom Grafana dashboards features:

Dashboard demo

Tests comparison

Getting Started

Framework consists of next services:

Framework architecture:

Prerequisites

To run framework install docker: https://docs.docker.com/engine/installation/.

You should be able to run docker run hello-world with no errors.

For Windows:

Installing

  1. Clone this repository git clone https://github.com/serputko/performance-testing-framework.git
  2. open performance-testing-framework dir

For Backend testing:

  1. (optional) if you want to update existing services
    docker-compose pull
    docker-compose build 
    docker-compose down
  2. docker-compose up -d

For Frontend + Backend testing

  1. (optional) if you want to update existing services
    docker-compose -f docker-compose-with-frontend.yml pull
    docker-compose -f docker-compose-with-frontend.yml build
    docker-compose -f docker-compose-with-frontend.yml down
  2. docker-compose -f docker-compose-with-frontend.yml up -d

All containers should be up and running

Services endpoints

Jenkins

Login to Jenkins with admin/admin(could be changed in docker-compose file) By default jenkins consists of 2 jobs:

Running demo jmeter scenario with BackendJob

To run jmeter demo script: Open BackendJob -> Build with Parameters -> Set build parameters -> Select scenario -> Build

This job will start jmeter docker container and execute demo_scenario.jmx jmeter scenario

To open demo_scenario in local instance of Jmeter please install Plugin Manager https://jmeter-plugins.org/wiki/PluginsManager/. It will automatically install all required plugins.

Making your jmeter script compatible with framework

Create jmeter test scenario

Modify your jmeter scenario to work with framework, add:

Grafana

Start demo_scenario.jmx test with jenkins Backend job

Real time results should be available in grafana Open 'Load test monitoring' dashboard. Dashboard contains visualizations based on data from influxdb.

Available metrics

Dashboard has multiple rows with different metrics

Timerange

All values in visualizations are calculated according to selected time range. Default timerange is last 15 min with 10 sec refresh. Timerange could be set in timepicker or selected on any graph.

Templating

Graphs and series on dashboard are displayed dynamically according to variables selected

Failed requests details

If JSR223 listener was added to scenario than detailed traces for failed requests can be viewed in 'Error details' table. Example of failed request:

Number of samples in transaction : 1, number of failing samples : 1
Login; Response message: Unauthorized;
Status code: 401;
Number of failed assertions: 1

Sample Failed: Login
Started at: Mon Jul 30 11:54:59 UTC 2018
Finished at: Mon Jul 30 11:54:59 UTC 2018
Request:
{
    "code": "1234567"
}
REQUEST DATA
URL: http://demo-server.com/login
Request headers:
Content-Type: application/json

Response: 
Unauthorized
Response code:401

Response data:
{
   "Error message": "Incorrect password or confirmation code entered. Please try again."
}

Assertion results:
Number of failed assertions: 1
Response Assertion Failed; 
Failure Message: Test failed: text expected to contain /success/;

Test runs comparison

Tests comparison is done using scripted js dashboard. It could be accessed at http://127.0.0.1:8857/dashboard/script/compare_tests.js

FrontendJob

To run frontend test: Open FrontendJob -> Build with Parameters -> Set build parameters -> Build

This job will start sitespeed.io docker container and run test with parameters using WebPageTest private instance

Frontend test deliverables: