{"id":23299590,"url":"https://github.com/smicyk/groovy-harventer","last_synced_at":"2025-04-06T20:42:14.215Z","repository":{"id":44243802,"uuid":"311118722","full_name":"smicyk/groovy-harventer","owner":"smicyk","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-10T22:47:42.000Z","size":114,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-02-13T02:44:52.659Z","etag":null,"topics":["groovy","har","jmeter","scripts"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smicyk.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-08T17:38:55.000Z","updated_at":"2022-02-10T21:36:20.000Z","dependencies_parsed_at":"2022-09-01T04:51:25.846Z","dependency_job_id":null,"html_url":"https://github.com/smicyk/groovy-harventer","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smicyk%2Fgroovy-harventer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smicyk%2Fgroovy-harventer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smicyk%2Fgroovy-harventer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smicyk%2Fgroovy-harventer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smicyk","download_url":"https://codeload.github.com/smicyk/groovy-harventer/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247550641,"owners_count":20956984,"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":["groovy","har","jmeter","scripts"],"created_at":"2024-12-20T08:18:44.121Z","updated_at":"2025-04-06T20:42:14.182Z","avatar_url":"https://github.com/smicyk.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Groovy Harventer \n\nConverts .HAR files to [Groovy JMeter DSL](https://github.com/smicyk/groovy-jmeter) scripts.\n\nThe [HTTP Archive format](http://www.softwareishard.com/blog/har-12-spec/) is used store communication data (HTTP protocol) between the server and the client.\n\nThe .HAR files can be obtained by various tools (including all major browsers).\n\n### Prerequisites\n\nBefore start, you should have:\n\n- [Java 11+](https://openjdk.java.net/)\n\n### How to start\n\nDownload [latest](https://github.com/smicyk/groovy-harventer/releases/latest) version from releases page and unpack in any folder. Go to __bin__ folder and execute following command:\n```shell script\n$ harventer -i yourharfile.har -o yourdslscript.groovy\n```\n\nIf in trouble try check 'help' option:\n```shell script\n$ harventer --help\n\nusage: harventer [options]\n -c,--compact                             If present the param and headers\n                                          will be generated in compact\n                                          form\n    --dsl-version \u003carg\u003e                   Specify which DSL version to use\n                                          for generated script\n    --exclude-headers \u003cpattern\u003e           Regex pattern for header name to\n                                          exclude (by default all headers\n                                          are excluded)\n    --exclude-types \u003cpattern\u003e             Regex pattern for response\n                                          content type to exclude (by\n                                          default css, javascript, images\n                                          and binary types are excluded)\n    --exclude-urls \u003cpattern\u003e              Regex pattern for URL to exclude\n                                          (by default .css, .js, .bmp,\n                                          .css, .js, .gif, .ico, .jpg,\n                                          .jpeg, .png, .swf, .woff,\n                                          .woff2)\n -h,--help                                Show help\n -H,--header-variables \u003cparam=variable\u003e   Substitute header with variable\n                                          (applies to request headers)\n -i,--input-file \u003cfile\u003e                   Input *.har file\n    --include-headers \u003cpattern\u003e           Regex pattern for header name to\n                                          include\n    --include-types \u003cpattern\u003e             Regex pattern for response\n                                          content type to include\n    --include-urls \u003cpattern\u003e              Regex pattern for URL to include\n    --loops=\u003cnumber\u003e                      Loops number for users\n -o,--output-file \u003cfile\u003e                  Output *.groovy file\n -P,--param-variables \u003cparam=variable\u003e    Substitute param with variable\n                                          (applies to request params)\n    --ramp-up \u003cnumber\u003e                    Ramp up time for test plan\n -t,--think-time                          If present each HTTP request has\n                                          think time based on real\n                                          execution\n -U,--url-variables \u003cparam=variable\u003e      Substitute part of URL with\n                                          variable\n    --users \u003cnumber\u003e                      Number of users for default\n                                          group\n```\n\n### Examples\n\nBelow you can find several examples of command execution:\n\n* the converter excludes all headers for HTTP request, but you can provide which you want to have in the script (use '|' to put several names)\n\n  ```shell script\n  $ harventer -i yourharfile.har -o yourdslscript.groovy --include-headers \"X-CSRF-TOKEN|Host\"\n  ```\n  The output from the command should look like code below (the converter adds header X-CSRF-TOKEN and Host if they exist):\n  ```groovy\n  start {\n      plan {\n          summary(path: 'yourdslscript.jtl', enabled: true)\n          group(users: 1, rampUp: 1, loops: 1) {\n\n              // defaults comes from the first request available in .HAR file\n              defaults(protocol: 'http', domain: 'localhost', port: 80)\n\n              http('POST /app') {\n                  // headers are automatically added to http request\n                  headers {\n                      header(name: 'X-CSRF-TOKEN', value: '2429304892384092384093')\n                      header(name: 'Host', value: 'localhost')\n                  }\n                  params {\n                      param(name: 'param1', value: 'value1')\n                  }\n              }\n          }\n      }\n  }\n  ```\n\n* the __--haeder-variables__ option creates JMeter variables placeholders for matching headers\n\n  ```\n  $ harventer -i yourharfile.har -o yourdslscript.groovy --include-headers \"X-CSRF-TOKEN\" --header-variables \"X-CSRF-TOKEN=var_csrfToken\"\n  ```\n\n  The output is very similar to previous one but this time, values for headers comes from defined variable:\n\n  ```groovy\n  start {\n      plan {\n          summary(path: 'yourdslscript.jtl', enabled: true)\n          group(users: 1, rampUp: 1, loops: 1) {\n              variables {\n                  // variable defined on the command line\n                  variable(name: 'var_csrfToken', value: '')\n              }\n\n              // defaults comes from the first request available in .HAR file\n              defaults(protocol: 'http', domain: 'localhost', port: 80)\n\n              http('POST /app') {\n                  // headers are automatically added to http request\n                  headers {\n                      header(name: 'X-CSRF-TOKEN', value: '${var_csrfToken')\n                  }\n                  params {\n                      param(name: 'param1', value: 'value1')\n                  }\n              }\n          }\n      }\n  }\n  ```\n  The options __--param-variables__ works pretty much the same but for HTTP parameters\n\n* Next example shows how to automatically add users, ramp up and loops for you test plan, with __--users__,  __--ramp-up__ and __--loops__ options:\n\n  ```shell script\n  $ harventer -i yourharfile.har -o yourdslscript.groovy --users 10 --rampUp 60 --loops 10\n  ```\n\n  ```groovy\n  start {\n      plan {\n          group(users: 10, rampUp: 60, loops: 10) {\n              // rest of script\n          }\n      }\n  }\n  ```\n\n* The __--think-time__ option add small wait time between each sample execution. Converter extracts times from .HAR files. With this option the script can more precisely simulate real user interaction.\n\n  ```shell script\n  $ harventer -i yourharfile.har -o yourdslscript.groovy --think-time\n  ```\n  Output from the command:\n  ```groovy\n  start {\n      plan {\n          group(users: 1, rampUp: 1, loops: 1) {\n              http('POST /app') { }\n              flow(name: 'Think Time', action: 'pause', duration: 0) {\n                  uniform_timer(name: 'Pause', deloay: '716', range: 100)\n              }\n\n              http('GET /app/form') { }\n              flow(name: 'Think Time', action: 'pause', duration: 0) {\n                  uniform_timer(name: 'Pause', deloay: '300', range: 100)\n              }\n          }\n      }\n  }\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmicyk%2Fgroovy-harventer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmicyk%2Fgroovy-harventer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmicyk%2Fgroovy-harventer/lists"}