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
This framework could be used both for backend load testing with Apache Jmeter and frontend load test with sitespeed.io + webpagetest private instance.
Framework consists of next services:
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:
setx COMPOSE_CONVERT_WINDOWS_PATHS "1" /M
or simply install older version of docker https://download.docker.com/win/stable/15139/Docker for Windows Installer.exegit clone https://github.com/serputko/performance-testing-framework.git
For Backend testing:
docker-compose pull
docker-compose build
docker-compose down
docker-compose up -d
For Frontend + Backend testing
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
docker-compose -f docker-compose-with-frontend.yml up -d
All containers should be up and running
Login to Jenkins with admin/admin(could be changed in docker-compose file)
By default jenkins consists of 2 jobs:
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.
Create jmeter test scenario
Modify your jmeter scenario to work with framework, add:
JSR223 Listener from demo scenario
Contains groovy script that:
Backend Listener from demo scenario
Sends samplers data to influxdb database. Fields:
.jmx file title @ jenkins build number @ test start time (f.e. demo_scenario.jmx @ 18 @ Sat Jul 28 09:44:26 UTC 2018)
Jenkins build #18 http://127.0.0.1:8181/job/BackendJob/18/ with demo_scenario.jmx scenario with 10 users, 180 sec rampup and 600 sec duration was started
Data from these fields will be displayed in grafana dashboard annotations- Green/Red vertical lines that stands for test Start/End.
(optional) jp@gc - Console Status Logger
sends minimalistic stats to jenkins console output about test execution:
#43 Threads: 3/10 Samples: 16 Latency: 23 Resp.Time: 197 Errors: 2
#44 Threads: 3/10 Samples: 16 Latency: 32 Resp.Time: 203 Errors: 1
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.
Dashboard has multiple rows with different metrics
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.
Graphs and series on dashboard are displayed dynamically according to variables selected
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/;
Tests comparison is done using scripted js dashboard. It could be accessed at http://127.0.0.1:8857/dashboard/script/compare_tests.js
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: