This solution can help you create reports on JMeter tests in the Allure Report format.
However, please note that it is NOT USABLE for load testing.
docker compose up && \
docker cp jmeter:/result/allure-results allure-results-example &&\
docker rm -f jmeter &&\
allure generate allure-results-example --clean -o allure-report
allure open allure-report/
chmod +x installer.sh
./installer.sh
./apache-jmeter/bin/jmeter -t allure-jmeter-example.jmx
allure generate allure-results/ --clean -o allure-report
allure open allure-report/
Then you should change the two variables in User Defined Variables to an absolute path and click RUN.
'/result/allure-results'
allure-results
folderallure-reporter.groovy
(this file is already located in the root directory).allure-reporter.groovy
First, you need to initialize the parameters that are required to generate test results:
If the case consists of several steps, it should look like this:
Declare annotations before first step:
Declare parameters in JSR223 Assertion:
For example, if the case consists of one step a validation check looks like this:
Do not use parameters if case has one step:
Default report looks like this:
allure-results
folder for generating the report.
Next, you can generate the Allure Report by using the following command:
allure generate allure-results --clean -o allure-report
Allure Report would look like this:
Assertion |
---|
Response Assertion |
JSON Assertion |
Size Assertion |
jp@gc - JSON/YAML Path Assertion |
It should also work with the rest of the default assertions.
If you would like to ignore test case, just add 'skipped' to the parameters near 'stop':
If you have critical main case to prepares data for next tests, you may use 'critical' parameters. If this case fails - all next tests (thread group) will be stopped.
The Markdown Table Data-driven Controller plugin allows you to use parameterized tests. We can put our params to the report
vars.put("allure.parameters","capsule_name,second_example_name_variable")
Add parameters to the sub annotations like this:
parameters=[error_message_expected]
// if step parameters more 1 - write with comma like
// parameters=[variable1,variable2,error_message_expected]
You can add some description to your test using this variable
vars.put("allure.description","Lorem Ipsum is simply dummy text of the printing and typesetting industry. \\nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book");
Content-type is set automatically. If the default content-type of the response is incorrect, you can change it manually:
content_type=[application/pdf]
You can add any links to your test like this:
vars.put("allure.links","issue,https://github.com/nonealexq/jmeter-allure-reporting/issues/6");
Also, you can add multiple links in one string like:
vars.put("allure.links","issue,https://github.com/nonealexq/jmeter-allure-reporting/issues/8," + "google.com,https://google.com");
You can add any issues to your test like this:
vars.put("allure.label.issue","JIRA_PROJECT_ID-100");
Also, you can add multiple issues in one string like:
vars.put("allure.label.issues","JIRA_PROJECT_ID-100,"JIRA_PROJECT_ID-129");
If you want to add some custom label (for example severity/owner/tag) - you can do it!
vars.put("allure.label.severity","critical");
vars.put("allure.label.owner","None Alex");
vars.put("allure.label.tag","smoke");
Also, you can add multiple tags like this:
vars.put("allure.label.tags","critical,smoke,api,");
This is often useful if you are create tests in MarkDown Table Data Driven Controller.
When you need to create report one of the test without tags/links from Declare allure annotations
you can use this parameters:
ignore_links
- will not add any links to your solostep testignore_tags
- will not add any tags to your solostep testLook and feel with additional features:
We do not recommend storing sensitive information in the reports. By default, all mentions of such information are overwritten
If you want to use Test Fragments with prefix in CI - use this structure of .jmx files:
├── project-folder/
│ ├── test-plan/
│ │ ├── service-one.jmx
│ │ ├── service-two.jmx
│ │ ├── test_fragments/
│ │ │ ├── test-fragment-one.jmx
│ │ │ └── test-fragment-two.jmx
│ │ └──
│ └──
└──
Default docker nonealexq/jmeter:5.6.2
container will use include_prefix like /mnt/jmeter/test-plan/test_fragments/
. It will be equated your local include_prefix.
Environment in container:
ENV JMETER_HOME="/opt/apache-jmeter/bin"
ENV JMETER_LIB="/opt/apache-jmeter/lib"
ENV TEST_FRAGMENTS_FOLDER="/mnt/jmeter/test-plan/test_fragments/"
Use docker-compose up
to clone data to container and run tests
Volumes:
volumes:
- ./:/mnt/jmeter
- ./allure-results:/result/allure-results
If you want to save results - use
docker cp jmeter:/result ./results
It will copy your results from container to your agent.