{"id":21985175,"url":"https://github.com/loadmill/loadmill-node","last_synced_at":"2025-04-30T08:05:02.528Z","repository":{"id":22595491,"uuid":"96782508","full_name":"loadmill/loadmill-node","owner":"loadmill","description":"A node.js module for running load tests and functional tests on loadmill.com","archived":false,"fork":false,"pushed_at":"2024-09-08T07:16:34.000Z","size":315,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-09T06:52:19.262Z","etag":null,"topics":["api-testing","crowdsourcing","load-testing","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/loadmill.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-10T13:45:57.000Z","updated_at":"2024-09-08T06:06:27.000Z","dependencies_parsed_at":"2024-03-31T10:25:00.426Z","dependency_job_id":"a5abef6a-395d-4b1e-9301-4308f22839ae","html_url":"https://github.com/loadmill/loadmill-node","commit_stats":{"total_commits":159,"total_committers":13,"mean_commits":12.23076923076923,"dds":0.6603773584905661,"last_synced_commit":"7fb42d009c15984528d4ac361b3e1e32d8b6ab5c"},"previous_names":[],"tags_count":69,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadmill%2Floadmill-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadmill%2Floadmill-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadmill%2Floadmill-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loadmill%2Floadmill-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loadmill","download_url":"https://codeload.github.com/loadmill/loadmill-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227185437,"owners_count":17744371,"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":["api-testing","crowdsourcing","load-testing","nodejs"],"created_at":"2024-11-29T18:12:47.837Z","updated_at":"2024-11-29T18:12:48.461Z","avatar_url":"https://github.com/loadmill.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loadmill\n\nUsers of [Loadmill](https://www.loadmill.com) can use this node module to: \n1. Run API tests on loadmill.com.\n2. Run load tests on loadmill.com.\n3. Do both programmatically or via [CLI](#cli).\n\n## Installation\n\nUsing npm:\n\n`npm install loadmill --save`\n\nUsing yarn:\n\n`yarn add loadmill`\n\nIf you need to run the loadmill CLI outside of an npm script, you may prefer to install this package globally.\n\nUsing npm:\n\n`npm install -g loadmill`\n\nUsing yarn:\n\n`yarn global add loadmill`\n\n## Usage\n\n### API Tokens\nIn order to use the Loadmill REST API or our node module and CLI, you will need to generate an [API Token](https://docs.loadmill.com/integrations/api-tokens).\n\n### Test Plans\n\nYou can launch an existing test plan by supplying the test plan id:\n\n```js\nconst testPlan = await loadmill.runTestPlan(\n    {\n        id: \"test-plan-uuid\" // required\n        options: { //optional\n            additionalDescription: \"description to add\", // added at the end of of each test suite\n            labels: [\"label1\", \"label2\"], // run suites that have flows assigned to specific label/s\n            pool: \"some-pool-name\", // Execute tests from a dedicated agent's pool (when using private agent)\n            parallel: 2 , // Set the concurrency amount of a running test suites in a test plan. Max concurrency is 10\n            tags: [\"tag1\", \"another tags\"], // Set of strings attached to the plan run and later can be query by\n        }\n    },\n    { \"parameterKey\": \"overrided value\" } //optional\n);\n\nconst result = await loadmill.wait(testPlan);       \n```\n\n### Load tests\n\nThe following code runs a very simple load test that gets a single page from `www.myapp.com` every second for one minute:\n```js\nconst loadmill = require('loadmill')({token: process.env.LOADMILL_API_TOKEN});\n\n// You may also give a path to a valid Test Configuration JSON file instead:\nconst id = await loadmill.run({requests: [{url: \"www.myapp.com\"}]});\nconsole.log(\"Load test started: \" + id);\n```\n\n### Test Configuration\n\nThe JSON test configuration may be exported from the loadmill test editor or from an old test run.\n\nRead more about the configuration format [here](https://docs.loadmill.com/load-testing/working-with-the-test-editor/configuration-files).\n\n\n### Waiting for Tests\n\nSince load tests usually run for at least a few minutes, the loadmill client does not wait for them to finish by default.\nYou can explicitly wait for a test to finish using the `wait` function:\n ```js\n/**\n * @returns {id: string, type: 'load' | 'test-plan', passed: boolean, url: string}\n */\nloadmill.run(\"./load-tests/long_test.json\")\n    .then(loadmill.wait)\n    .then(result =\u003e console.log(result));\n\n// promise with async/await\nconst loadTestId = await loadmill.run({ requests: [{ url: \"www.myapp.com\" }] });\nconst result = await loadmill.wait(loadTestId);\n```\n\n### Parameters\n\nYou will usually want some part of your test to be _dynamic_, e.g. the host name of the tested server.\nWith Loadmill, this is made easy by using [parameters](https://docs.loadmill.com/api-testing/test-suite-editor/parameters).\nYou may set/override parameter defaults for a test by passing a hash mapping parameter names to values:\n```js\n// Parameters may come before or instead of a callback:\nloadmill.run(\"./load-tests/parametrized_test.json\", {host: \"test.myapp.com\", port: 4443}, (err, id) =\u003e {/*...*/});\n```\n\n## CLI\n\nThe loadmill Command Line Interface basically wraps the functions provided by the node module:\n```\nloadmill \u003ctest-plan-id || load-test-config-file\u003e -t \u003ctoken\u003e [options] [parameter=value...]\n```\n\n### Test Plan\n\nYou may launch a test plan by setting the --test-plan option:\n\n```\nloadmill  \u003ctest-plan-id\u003e --test-plan -w -v -t \u003ctoken\u003e --report --colors --labels \"label1,label2\"\n```\n\nset the `-w` or `--wait` option in order to wait for the test-plan to finish, in which case only the result JSON will be\nprinted out at the end\n\nYou can add an additional description at the end of the current plan's description with the `--additional-description \u003cdescription\u003e` option.\n\nYou can tell loadmill to run flows that are assigned to a specific label with the `--labels \u003clabels\u003e` option. Multiple labels can be provided by seperated them with \",\" (e.g. 'label1,label2').\n\n```\nloadmill \u003ctest-plan-id\u003e --test-plan -t \u003ctoken\u003e --labels \"label1,label2\" --additional-description \"build 1986\"\n```\n\n### Load Tests\n\nYou may launch a load test by setting the `-l` or `--load-test` option:\n```\nloadmill test.json --load-test -t DW2rTlkNmE6A3ax5LVTSDxv2Jfw4virjQpmbOaLG\n```\n\nThe load test will be launched and its unique identifier will be printed to the standard output. You may alternatively\nset the `-w` or `--wait` option in order to wait for the load test to finish, in which case only the result JSON will be\nprinted out at the end:\n```\nloadmill test.json -lw -t DW2rTlkNmE6A3ax5LVTSDxv2Jfw4virjQpmbOaLG\n```\n\n### Exit Status\n\nUnless the `-n` or `--no-bail` option is set, the CLI process will exit with a nonzero exit code if the test had not passed.\nOther errors, such as invalid command line arguments or unavailable network will always give a nonzero exit status.\n\n### Parameters\n\nYou may set loadmill parameter values via command line arguments by passing `name=value` pairs:\n```\nloadmill parametrized_test.json host=test.myapp.com port=4443 -t DW2rTlkNmE6A3ax5LVTSDxv2Jfw4virjQpmbOaLG\n```\nOr supply a file using `--parameters-file`.\n\nBy default, overridden parameters are appended to the end of the parameters list. However, you can use the `inlineParameterOverride` flag to replace the parameters inline.\n\n### CLI Options\n\nFull list of command line options:\n\n- `-h, --help` Output usage information.\n- `-t, --token \u003ctoken\u003e` Provide a Loadmill API Token. You must provide a token in order to run tests.\n- `-l, --load-test` Launch a load test. \n- `--test-plan` Launch a test plan (default). \n- `-p, --parallel` Set the concurrency of a running test suites in a test plan. Max concurrency is 10.\n- `--additional-description \u003cdescription\u003e` Add an additional description at the end of the current test-plan's description.\n- `--labels \u003clabels\u003e`, Run flows that are assigned to a specific label. Multiple labels can be provided by seperated them with \",\" (e.g. 'label1,label2'). \n- `--labels-expression \u003clabelsExpression\u003e`, Run a test plan's suites with flows that match the labels expression. An expression may contain the characters ( ) \u0026 | ! (e.g. '(label1 | label2) \u0026 !label3')\n- `--pool \u003cpool\u003e` Execute tests from a dedicated agent's pool (when using private agent). \n- `--tags \u003ctags\u003e` Tag a test plan run with a comma separated list of tags (e.g. 'tag1,tag2'). \n- `-b --branch \u003cbranch\u003e` Run the test plan's suites from a GitHub branch. The latest version of the selected Git branch will be used as the test configuration for the chosen Test Plan. \n- `--retry-failed-flows \u003cnumberOfRetries\u003e` Configure the test plan to re-run failed flows in case your tested system is unstable. Tests that pass after a retry will be considered successful. \n- `--parameters-file \u003cparametersFile\u003e` Supply a file with parameters to override. File format should be 'name=value' divided by new line.\n- `-w, --wait` Wait for the test to finish. \n- `-n, --no-bail` Return exit code 0 even if test fails.\n- `-q, --quiet` Do not print out anything (except errors).\n- `-v, --verbose` Print out extra information for debugging (trumps `-q`). In case of an error will print the entire test's requests otherwise will print only the failed request.\n- `-r, --report` Print out Test Suite Flow Runs report when the plan has ended.\n- `--errors-report` Print out Test Suite Flow Runs errors report when the plan has ended.\n- `-j, --junit-report` Create Test Suite (junit style) report when the suite has ended.\n- `--junit-report-path \u003cpath\u003e` Save junit styled report to a path (defaults to current location) when `-j` flag is on.\n- `-m, --mochawesome-report` Create Test Suite (mochawesome style) report when the suite has ended.\n- `--mochawesome-report-path \u003cmochawesomeReportPath\u003e` Save JSON mochawesome styled report to a path (defaults to current location) when `-m` flag is on.\n- `--colors` Print test results in color.\n- `--inlineParameterOverride` Override parameters strategy - by default overrided parameters are appended to the end of the parameters list. Using this flag will replace the parameters inline.\n- `--apiCatalogService \u003capiCatalogService\u003e` Use the provided service when mapping the APIs in the catalog. Service will be created if not exist.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadmill%2Floadmill-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floadmill%2Floadmill-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floadmill%2Floadmill-node/lists"}