{"id":24580068,"url":"https://github.com/vdaburon/junitreportkpijmeterdashboardstats","last_synced_at":"2025-03-17T15:17:21.090Z","repository":{"id":165509648,"uuid":"640871393","full_name":"vdaburon/JUnitReportKpiJMeterDashboardStats","owner":"vdaburon","description":"This tool read KPI declarations in a file and apply the KPI assertion on a JMeter Dashboard Statistics Json file and generates a result file in JUnit XML format and others Html, JSON or CSV formats. ","archived":false,"fork":false,"pushed_at":"2023-07-11T18:06:54.000Z","size":282,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-07T18:13:29.044Z","etag":null,"topics":["cicd","jmeter","jmeter-plugin","jmeter-plugins","junit","junit-xml","kpi","kpis"],"latest_commit_sha":null,"homepage":"","language":"Java","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/vdaburon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-05-15T09:55:12.000Z","updated_at":"2024-02-26T16:55:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3a8ce43-0d76-49c3-8bdd-10b586a49073","html_url":"https://github.com/vdaburon/JUnitReportKpiJMeterDashboardStats","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaburon%2FJUnitReportKpiJMeterDashboardStats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaburon%2FJUnitReportKpiJMeterDashboardStats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaburon%2FJUnitReportKpiJMeterDashboardStats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaburon%2FJUnitReportKpiJMeterDashboardStats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vdaburon","download_url":"https://codeload.github.com/vdaburon/JUnitReportKpiJMeterDashboardStats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056429,"owners_count":20390720,"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":["cicd","jmeter","jmeter-plugin","jmeter-plugins","junit","junit-xml","kpi","kpis"],"created_at":"2025-01-24T01:32:38.184Z","updated_at":"2025-03-17T15:17:21.070Z","avatar_url":"https://github.com/vdaburon.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generating JUnit Report based on custom Key Performance Indicators (KPIs) applied to the JMeter Dashboard Statistics Json file\n\nThis tool read KPI declarations in a file and apply the KPI assertion on a JMeter Dashboard Statistics Json file and generates a result file in JUnit XML format and others formats Html, Json and Csv.\n\n[Manual Dashboard](https://jmeter.apache.org/usermanual/generating-dashboard.html#report)\nJMeter Dashboard Statistics Json file could be generated in Command Line Interface (CLI) with :\n- Generation from an existing sample CSV log file\n  - jmeter -g \u0026lt;log file\u0026gt; -o \u0026lt;Path to output folder\u0026gt;\n  - jmeter -g \u0026lt;log file\u0026gt; -o \u0026lt;Path to output folder\u0026gt; -Jjmeter.reportgenerator.exporter.html.series_filter=\"SC[0-9]+_.*\" -Jjmeter.reportgenerator.overall_granularity=4000 (with filter and granularity parameters)\n- Generation after load test\n  - jmeter -n -t \u0026lt;test JMX file\u0026gt; -l \u0026lt;test log file\u0026gt; -e -o \u0026lt;Path to output folder\u0026gt;\n\nThe JMeter Dashboard Json file statistics.json is created in the \u0026lt;Path to output folder\u0026gt;\u003cbr\u003e\n![statistics json file in a dashboard directory](doc/images/directory_dashboard_json_file.png)\n\n\n## The KPI file format\nThe KPI file needs 5 columns :\n1) name_kpi the name of the KPI also the classname in the Test Case in JUnit\n2) metric_json_attribute the attribute name in the statistics.json file (**Attributes** are : `sampleCount` or `errorCount` or `errorPct` or `meanResTime` or `medianResTime` or `minResTime` or `maxResTime` or `pct1ResTime` (90 percentile) or `pct2ResTime` (95 percentile) or `pct3ResTime` (99 percentile) or `throughput` or `receivedKBytesPerSec` or `sentKBytesPerSec`)\n3) label_regex the Label name in regular expression, the transaction attribute in the JMeter Dashboard statistics.json file (E.g : `SC01_P.*` or `SC\\d+_P.*` or `SC01_P01_LOGIN` or `SC01_P01_LOGIN|SC01_P02_HOME` or `\\d+ /.*` )\n4) comparator the comparator `\u003c` or `\u003c=` or `\u003e` or `\u003e=`\n5) threshold the value (for percentage rate `errorPct` use value between 0 and 1, e.g : 0.02 for 2%)\n\nThe column separator is ',' for the kpi file\n\u003cpre\u003e\nname_kpi,metric_json_attribute,label_regex,comparator,threshold\nPercentiles_90,pct1ResTime,SC\\d+_P.*,\u003c=,2000\nPercentiles_90 specific pages,pct1ResTime,SC01_P03_LOGIN|SC03_P03_LOGIN,\u003c=,10\nAverage Pages,meanResTime,SC\\d+_P.*,\u003c=,2000\nErrors Rate,errorPct,SC\\d+_SCRIPT.*,\u003c,0.01\nMax time specific API,maxResTime,SC01_P05_LANCE_RECH,\u003c=,100\nNumber pages,sampleCount,SC.*,\u003e,100\n\u003c/pre\u003e\n\nKPI View in Excel\u003cbr\u003e\n![kpi in Excel](doc/images/kpi_excel.png)\n\nSave in UTF-8 comma separator **no BOM** or csv with comma separator if you have only ASCII characters (no accent é,è, à ...)\n\n## Parameters \nThe tool have parameters :\n\u003cpre\u003e\nusage: io.github.vdaburon.jmeter.utils.jsonkpi.JUnitReportFromJMDashboardStats [-csvOutFile \u0026lt;csvOutFile\u0026gt;] [-divHtmlOutFile \u0026lt;divHtmlOutFile\u0026gt;]\n       [-exitReturnOnFail \u0026lt;exitReturnOnFail\u0026gt;] [-help] [-htmlOutFile \u0026lt;htmlOutFile\u0026gt;] [-jsonOutFile \u0026lt;jsonOutFile\u0026gt;] -jsonStats \u0026lt;jsonStats\u0026gt;\n       [-junitFile \u0026lt;junitFile\u0026gt;] -kpiFile \u0026lt;kpiFile\u0026gt;\nio.github.vdaburon.jmeter.utils.jsonkpi.JUnitReportFromJMDashboardStats\n -csvOutFile \u0026lt;csvOutFile\u0026gt;               Csv out file result optional (E.g: result.csv)\n -divHtmlOutFile \u0026lt;divHtmlOutFile\u0026gt;       Div Partial Html Page out file result optional (E.g: div_result.html), to include in an another HTML\n                                        Page\n -exitReturnOnFail \u0026lt;exitReturnOnFail\u0026gt;   if true then when kpi fail then create JUnit XML file and program return exit 1 (KO); if false\n                                        [Default] then create JUnit XML File and exit 0 (OK)\n -help                                  Help and show parameters\n -htmlOutFile \u0026lt;htmlOutFile\u0026gt;             Html out file result optional (E.g: result.html)\n -jsonOutFile \u0026lt;jsonOutFile\u0026gt;             Json out file result optional (E.g: result.json)\n -jsonStats \u0026lt;jsonStats\u0026gt;                 JMeter Dashboard stats file (E.g : statistics.json)\n -junitFile \u0026lt;junitFile\u0026gt;                 junit file name out (Default : jmeter-junit-plugin-jmstats.xml)\n -kpiFile \u0026lt;kpiFile\u0026gt;                     KPI file contains rule to check (E.g : kpi.csv)\nE.g : java -jar junit-reporter-kpi-from-jmeter-dashboard-stats-\u0026lt;version\u0026gt;-jar-with-dependencies.jar -jsonStats statistics.json  -kpiFile\nkpi.csv -exitReturnOnFail true\nor more parameters : java -jar junit-reporter-kpi-from-jmeter-dashboard-stats-\u0026lt;version\u0026gt;-jar-with-dependencies.jar -jsonStats statistics.json\n-kpiFile kpi_check.csv -junitFile junit.xml -htmlOutFile result.html -divHtmlOutFile div_result.html -csvOutFile result.csv -jsonOutFile\nresult.json -exitReturnOnFail false\n\u003c/pre\u003e\n\n## JUnit Report XML file generated\nExample JUnit XML file generated :\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?\u003e\n\u003ctestsuite errors=\"0\" failures=\"2\" name=\"JUnit Report From Dashboard Statistics\" skipped=\"0\" tests=\"6\"\u003e\n  \u003ctestcase classname=\"Percentiles_90\" name=\"pct1ResTime (SC\\d+_P.*) \u0026lt;= 2000\"/\u003e\n  \u003ctestcase classname=\"Percentiles_90 specific pages\" name=\"pct1ResTime (SC01_P03_LOGIN|SC03_P03_LOGIN) \u0026lt;= 10\"\u003e\n    \u003cfailure message=\"\"\u003eActual value 57.0 exceeds or equals threshold 10.0 for samples matching \"SC01_P03_LOGIN|SC03_P03_LOGIN\"; fail label(s) \"SC03_P03_LOGIN\"\u003c/failure\u003e\n  \u003c/testcase\u003e\n  \u003ctestcase classname=\"Average Pages\" name=\"meanResTime (SC\\d+_P.*) \u0026lt;= 2000\"/\u003e\n  \u003ctestcase classname=\"Errors Rate\" name=\"errorPct (SC\\d+_SCRIPT.*) \u0026lt; 0.01\"/\u003e\n  \u003ctestcase classname=\"Max time specific API\" name=\"maxResTime (SC01_P05_LANCE_RECH) \u0026lt;= 100\"/\u003e\n  \u003ctestcase classname=\"Number pages\" name=\"sampleCount (SC.*) \u0026gt; 100\"\u003e\n    \u003cfailure message=\"\"\u003eActual value 33.0 is less then threshold 100.0 for samples matching \"SC.*\"; fail label(s) \"SC03_P01_ACCUEIL\", \"SC03_P03_LOGIN\", \"SC03_P04_LIEN_STATS\", \"SC03_P02_DMD_FORM_LOGIN\", \"SC03_P05_LIEN_RETOUR_MENU\", \"SC03_SCRIPT_STATS\", \"SC03_P06_LOGOUT\"\u003c/failure\u003e\n  \u003c/testcase\u003e\n\u003c/testsuite\u003e\n```\nRemark : failure message is limited to 1024 characters, if failure message finished with \"...\" then the message is voluntarily truncated.\n\n## JUnit Report in a Gitlab Pipeline\nA JUnit Report with KPIs display in a Gitlab Pipeline\u003cbr\u003e\n![junit gitlab pipeline](doc/images/junit_report_in_gitlab_pipeline.png)\n\nIf you click on button \"View Details\" for Status Fail, you will show the fail message\u003cbr\u003e\n![junit gitlab pipeline detail fail](doc/images/junit_report_in_gitlab_pipeline_detail_fail.png)\n\n## JUnit Report in Jenkins Build\nA JUnit Report with KPIs display in Jenkins Build\u003cbr\u003e\n![junit jenkins build](doc/images/junit_report_jenkins.png)\n\nIf you click on link \"Name Test\" fail , you will show the fail message\u003cbr\u003e\n![junit jenkins build detail fail](doc/images/junit_report_jenkins_detail_fail.png)\n\n## Html out format\nThe result could be a html page ou partial html page (div)\n![html out format](doc/images/html_out_result.png)\n\n## Csv out format\nThe result in a csv file\n![csv out format](doc/images/csv_out_result.png)\n\n## Json out format\nThe result in a Json file\n![csv out format](doc/images/json_out_result.png)\n\n## License\nSee the LICENSE file Apache 2 [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)\n\n## Usage Maven\nThe maven groupId, artifactId and version, this plugin is in the **Maven Central Repository** [![Maven Central junit-reporter-kpi-from-jmeter-report-csv](https://maven-badges.herokuapp.com/maven-central/io.github.vdaburon/junit-reporter-kpi-from-jmeter-dashboard-stats/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.vdaburon/junit-reporter-kpi-from-jmeter-dashboard-stats)\n\n```xml\n\u003cgroupId\u003eio.github.vdaburon\u003c/groupId\u003e\n\u003cartifactId\u003ejunit-reporter-kpi-from-jmeter-dashboard-stats\u003c/artifactId\u003e\n\u003cversion\u003e1.4\u003c/version\u003e\n```\nJust include the plugin in your `pom.xml` and execute `mvn verify` \u003cbr\u003e\nor individual launch `mvn -DjsonStats=statistics.json -DkpiFile=kpi.csv -DjunitFile=jmeter-junit-plugin-jmstats.xml exec:exec@create_junit-report-kpi-from-jmeter-json-statics`\n\n```xml\n\n\u003cproject\u003e\n  \u003cproperties\u003e\n    \u003cjsonStats\u003estatistics.json\u003c/jsonStats\u003e\n    \u003ckpiFile\u003ekpi.csv\u003c/kpiFile\u003e\n    \u003cjunitFile\u003ejmeter-junit-plugin-jmstats.xml\u003c/junitFile\u003e\n    \u003cprefix_script_name\u003egestdoc\u003c/prefix_script_name\u003e\n  \u003c/properties\u003e\n\n  \u003cdependencies\u003e\n    \u003cdependency\u003e\n      \u003cgroupId\u003eio.github.vdaburon\u003c/groupId\u003e\n      \u003cartifactId\u003ejunit-reporter-kpi-from-jmeter-dashboard-stats\u003c/artifactId\u003e\n      \u003cversion\u003e1.4\u003c/version\u003e\n    \u003c/dependency\u003e\n  \u003c/dependencies\u003e\n\n  \u003cbuild\u003e\n    \u003cplugins\u003e\n      \u003cplugin\u003e\n        \u003cgroupId\u003eorg.codehaus.mojo\u003c/groupId\u003e\n        \u003cartifactId\u003eexec-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.2.1\u003c/version\u003e\n        \u003cexecutions\u003e\n          \u003cexecution\u003e\n            \u003c!-- individual launch : mvn exec:exec@create_junit-report-kpi-from-jmeter-json-statics --\u003e\n            \u003cid\u003ecreate_junit-report-kpi-from-jmeter-json-statics\u003c/id\u003e\n            \u003cphase\u003everify\u003c/phase\u003e\n            \u003cgoals\u003e\n              \u003cgoal\u003eexec\u003c/goal\u003e\n            \u003c/goals\u003e\n            \u003cconfiguration\u003e\n              \u003carguments\u003e\n                \u003cargument\u003e-classpath\u003c/argument\u003e\n                \u003c!-- automatically creates the classpath using all project dependencies,\n                                     also adding the project build directory --\u003e\n                \u003cclasspath/\u003e\n                \u003cargument\u003eio.github.vdaburon.jmeter.utils.jsonkpi.JUnitReportFromJMDashboardStats\u003c/argument\u003e\n                \u003cargument\u003e-kpiFile\u003c/argument\u003e\n                \u003cargument\u003e${project.build.directory}/jmeter/testFiles/${kpiFile}\u003c/argument\u003e\n                \u003cargument\u003e-jsonStats\u003c/argument\u003e\n                \u003cargument\u003e${project.build.directory}/jmeter/reports/${prefix_script_name}/${jsonStats}\u003c/argument\u003e\n                \u003cargument\u003e-junitFile\u003c/argument\u003e\n                \u003cargument\u003e${project.build.directory}/jmeter/results/${junitFile}\u003c/argument\u003e\n                \u003cargument\u003e-exitReturnOnFail\u003c/argument\u003e\n                \u003cargument\u003etrue\u003c/argument\u003e\n              \u003c/arguments\u003e\n            \u003c/configuration\u003e\n          \u003c/execution\u003e\n        \u003c/executions\u003e\n      \u003c/plugin\u003e\n    \u003c/plugins\u003e\n  \u003c/build\u003e\n\u003c/project\u003e\n```\n\n## Simple jar tool\nThis tool is a java jar, so it's could be use as simple jar (look at [Release](https://github.com/vdaburon/JUnitReportKpiJMeterDashboardStats/releases) to download jar file)\n\u003cpre\u003e\njava -jar junit-reporter-kpi-from-jmeter-dashboard-stats-\u0026lt;version\u0026gt;-jar-with-dependencies.jar -jsonStats statistics.json -kpiFile kpi.csv -junitFile junit-report.xml -exitReturnOnFail true\n\u003c/pre\u003e\n\n## Tool installed with jmeter-plugins-manager \nThis tool could be installed with the jmeter-plugins-manager from jmeter.plugins.org.\u003cbr\u003e\nThe tool name is : \"vdn@github - junit-reporter-kpi-from-jmeter-dashboard-stats tool\"\n\nin JMETER_HOME\\bin (Windows)\n\u003cpre\u003e\njunit-reporter-kpi-from-jmeter-dashboard-stats.cmd -jsonStats statistics.json -kpiFile kpi.csv -junitFile junit-report.xml -htmlOutFile result.html -csvOutFile result.csv\n\u003c/pre\u003e\nor \u003cbr\u003e\nin JMETER_HOME/bin (Linux or MacOS)\n\u003cpre\u003e\njunit-reporter-kpi-from-jmeter-dashboard-stats.sh -jsonStats statistics.json -kpiFile kpi.csv -junitFile junit-report.xml -htmlOutFile result.html -csvOutFile result.csv\n\u003c/pre\u003e\n\n## Link to others projects \nUsually this plugin is use with [jmeter-maven-plugin](https://github.com/jmeter-maven-plugin/jmeter-maven-plugin) set `\u003cgenerateReports\u003etrue\u003c/generateReports\u003e` to generate the dashboard with `statistics.json` file.\u003cbr\u003e\n\nYou could also use [jmeter-graph-tool-maven-plugin](https://github.com/vdaburon/jmeter-graph-tool-maven-plugin)\n\n## Versions\nversion 1.4 add jmeter-plugins.org installer\n\nversion 1.3 export result in html, json or csv format\n\nVersion 1.2 change the Test Suite Name\n\nVersion 1.1 change Fail Message when equality\n\nVersion 1.0 initial version\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdaburon%2Fjunitreportkpijmeterdashboardstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdaburon%2Fjunitreportkpijmeterdashboardstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdaburon%2Fjunitreportkpijmeterdashboardstats/lists"}