{"id":13650705,"url":"https://github.com/cfpb/jmeter-bootstrap","last_synced_at":"2025-04-09T20:15:34.523Z","repository":{"id":12933091,"uuid":"15610845","full_name":"cfpb/jmeter-bootstrap","owner":"cfpb","description":"Downloads JMeter and JMeter plugins and demonstrates usage via examples. Suggested to be used as a git submodule","archived":false,"fork":false,"pushed_at":"2019-04-22T15:04:16.000Z","size":25,"stargazers_count":38,"open_issues_count":1,"forks_count":26,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-04-09T20:15:28.505Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cfpb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-03T14:10:36.000Z","updated_at":"2025-01-16T00:02:44.000Z","dependencies_parsed_at":"2022-09-19T04:22:31.645Z","dependency_job_id":null,"html_url":"https://github.com/cfpb/jmeter-bootstrap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fjmeter-bootstrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fjmeter-bootstrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fjmeter-bootstrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cfpb%2Fjmeter-bootstrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cfpb","download_url":"https://codeload.github.com/cfpb/jmeter-bootstrap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T02:00:39.658Z","updated_at":"2025-04-09T20:15:34.487Z","avatar_url":"https://github.com/cfpb.png","language":"Python","readme":"# JMeter Bootstrap\n\n[![Build Status](https://travis-ci.org/cfpb/jmeter-bootstrap.png)](https://travis-ci.org/cfpb/jmeter-bootstrap)\n\nDownloads [JMeter](http://jmeter.apache.org/) and [JMeter plugins](http://jmeter-plugins.org/) and demonstrates usage via examples. Suitable for use as a submodule in other projects that contain JMeter load tests\n\n## Dependencies\n\n - Python 2.7 to install JMeter\n - Java 1.5+ to run JMeter\n\n## Why?\n\nTo encourage the creation and maintenance of load tests, we seek to reduce friction in the getting-started process.\n\nWorking with multiple people and projects on load testing, the need became apparent for a simple way to set up JMeter with Plugins, include sample tests, and promote best practices.\nA project such as this can shorten the time to get other developers started. In addition, it simplifies load test job configuration in a continuous integration environment.\n\n\n## Install JMeter and JMeter plugins\n\n```\n$ python bin/JMeterInstaller.py\n```\n\nThe installer will also install several JMeter Plugins, which can be used directly or within a continuous integration server such as Jenkins\n\n## Open Tests in JMeter\n\n```\napache-jmeter-3.0/bin/jmeter.sh -t tests/my_test.jmx\n```\n\nThis will load the JMeter GUI. This very simple test hits http://localhost 1 time, with 1 user\n\n- Run the tests with Command-R\n- See results by clicking in any of the Graph or Tree nodes\n- Stop tests with Command-period\n- Clear results with Command-E\n\n## Running Headless Tests\n\nEspecially in a continuous integration server, you'll want to run JMeter tests \"headlessly\", i.e. without a graphical user interface.\n\n```\nrm -rf results \u0026\u0026 mkdir results\napache-jmeter-3.0/bin/jmeter.sh -j results/jmeter.log -p tests/jmeter.properties -t tests/my_test.jmx -n -l results/my_test.jtl\n```\n\nLet's break this down:\n\n- `-j results/jmeter.log` indicates where JMeter should log its operations\n- `-p tests/jmeter.properties` is the properties file to use when running the test (more on properties later)\n- `-t tests/my_test.jmx` is the test to run\n- `-n -l results/my_test.jtl` tells JMeter to run in non-gui mode and provides the path where JMeter will write the test results.\n\n### Warning: JMeter logging and results **appends**\n\nWhen specifying a log file or .jtl output file, be aware that JMeter appends, not overwrites.\n\nConsequently, when setting up Jenkins jobs or even running headless tests in a terminal, you should always remove those files prior to a test run, as the examples above show\n\n\n## Generating Graphs from .jtl Results\n\nOne attractive feature of the JMeter plugins is the ability to generate graphs from the `.jtl` test results. Follow the \"Graphs\" links from the [JMeter Plugins wiki](http://jmeter-plugins.org/wiki/Start/)\n\nAfter running JMeter headlessly and generating a `.jtl` file, use `bin/generate_files_from_jtl.sh` to emit an aggregate .csv as well as .png files for useful graphs derived from the test results.\n\nContinuing with the example above, where you output a file named `my_test.jtl`, you can generate graphs like so:\n\n```\n$ bin/generate_files_from_jtl.sh my_test\n```\n\nNote that `my_test` is the prefix for your `results/my_test.jtl` file. If you had emitted a `.jtl` file named `lollipop.jtl`, you'd run `bin/generate_files_from_jtl.sh lollipop`\n\n## Running tests with Parameters\n\nJMeter provides the ability to parameterize tests, such that default values can be specified in the test, overridden in a properties file, and further overridden on the command line\n\nOpen `my_test_with_parameters.jmx`, like so:\n\n```\n$ apache-jmeter-3.0/bin/jmeter.sh -t tests/my_test_with_parameters.jmx\n```\n\nIn the GUI, click on the `HTTP Request Defaults` node and look at the `Server Name or IP` Field. You'll see this: `${__P(server, localhost)}`\n\nThe `${__P()}` is a JMeter parameter. The value in quotes is the default, should no value be supplied in a properties file or command line.\n\nIf you update the `jmeter.properties` file with a value: `server=my.server`, when you reload the test that value will be used for the server to be tested.\n\nTo override that at the command line, use JMeter's `-J` flag, which takes the form `-J[param_name]=value`:\n\n```\n$ apache-jmeter-3.0/bin/jmeter.sh -t tests/my_test_with_parameters.jmx -Jserver=my.test.server\n```\n\nIn the JMeter GUI, click on the `Thread Group` node. Notice a parameter is used for both Threads and Loop Count. To override those at the command line:\n\n```\n$ apache-jmeter-3.0/bin/jmeter.sh -t tests/my_test_with_parameters.jmx -Jserver=my.test.server -Jthreads=100 -Jloopcount=1000\n```\n\nThis will run the test against the `my.test.server` URL, with 100 concurrent users, repeating 1000 times.\n\n## Using jmeter-bootstrap as a Git Submodule\n\nTo use jmeter-bootstrap as a [Git submodule](http://git-scm.com/book/en/Git-Tools-Submodules) in your own test project, add the repo as a submodule.\n\nAssuming you have a project with this structure:\n\n```\n/my-project\n  /tests\n  /results\n```\n\nIssue:\n\n```git submodule add https://github.com/cfpb/jmeter-bootstrap.git```\n\nThis will pull the jmeter project as a git submodule into your own project. To run the JMeter installer:\n\n```\n$ python jmeter-bootstrap/bin/JMeterInstaller.py\n```\n\nWhich will pull JMeter into your project, resulting in a directory structure like:\n\n```\n/my-project\n  /apache-jmeter-3.0\n  /tests\n  /results\n```\n\n\n## Jenkins Jobs\n\nUsing a combination of plugins, you can create a Jenkins job to:\n\n1. Run your JMeter tests\n1. Fail on a certain error threshold\n1. Generate a report and graphs based on the test results\n1. Display those artifacts on the job results screen\n\n### Plugins\n\n1. [Performance Plugin](http://wiki.jenkins-ci.org/display/JENKINS/Performance+Plugin)\n1. [Image Gallery Plugin](http://jenkins-ci.org/plugin/image-gallery/)\n\n### Job Configuration\n\nA Common pattern is to use this jmeter-bootstrap project as a git submodule inside of another repo, such as `My-Load-Tests`. If you do that, you shouldn't have any additional work to do as Jenkins will also fetch submodules by default.\n\nIn the configuration below, I'll use simple paths to the jmeter-bootstrap location... in your job configuration, simply change the paths to point to the correct location.\n\n**Build Steps**\n\nYou can use a single `Execute Shell` step to do a one-time install of JMeter and the JMeter plugins, run your load tests, and emit graphs. It will look something like this:\n\n```\npython jmeter-bootstrap/bin/JMeterInstaller.py\nrm -rf results\nmkdir results\n\njmeter-bootstrap/apache-jmeter-3.0/bin/jmeter.sh -j results/jmeter.log -p tests/jmeter.properties -t tests/some_test.jmx -n -l results/some_test.jtl\n\n./jmeter-bootstrap/bin/generate_files_from_jtl.sh some_test\n```\n\n**Post-build Actions**\n\n1. Archive the artifacts.\n\nI typically use something like `results/*.png, results/*.html, results/*.csv` as the pattern\n\n2. Create Image Gallery\n\nI use \"Archived Image Gallery\" and include `**/results/*.png` as the pattern\n\n3. Publish performance test result report\n\nI add a `JMeter Report`, then for Report Files, I use `results/*.jtl`\n\n\nAfter you build, you'll see the graphs show up on the Build screen. Clicking on `Performance Report` will take you to a historical report showing you performance over time.\n\n## Roadmap\n\n- Windows compatibility\n- Python 2.6 and 3.3 compatibility","funding_links":[],"categories":["Distributions"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfpb%2Fjmeter-bootstrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcfpb%2Fjmeter-bootstrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcfpb%2Fjmeter-bootstrap/lists"}