{"id":18329615,"url":"https://github.com/jupiter-tools/stress-test","last_synced_at":"2025-10-09T12:13:05.578Z","repository":{"id":49963201,"uuid":"169849508","full_name":"jupiter-tools/stress-test","owner":"jupiter-tools","description":"Tools to write stress tests and benchmarks with Junit5.","archived":false,"fork":false,"pushed_at":"2023-02-26T21:51:26.000Z","size":980,"stargazers_count":7,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T15:11:07.436Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://jupiter-tools.com","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/jupiter-tools.png","metadata":{"files":{"readme":"README.adoc","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}},"created_at":"2019-02-09T09:08:07.000Z","updated_at":"2024-04-30T05:09:47.000Z","dependencies_parsed_at":"2022-09-02T03:31:14.338Z","dependency_job_id":null,"html_url":"https://github.com/jupiter-tools/stress-test","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupiter-tools%2Fstress-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupiter-tools%2Fstress-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupiter-tools%2Fstress-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupiter-tools%2Fstress-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jupiter-tools","download_url":"https://codeload.github.com/jupiter-tools/stress-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423474,"owners_count":20936621,"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-11-05T19:18:04.707Z","updated_at":"2025-10-09T12:13:00.545Z","avatar_url":"https://github.com/jupiter-tools.png","language":"Java","readme":":toc: preamble\n\n# StressTest\n\nimage:https://travis-ci.com/jupiter-tools/stress-test.svg?branch=master[\"Build Status\", link=\"https://travis-ci.com/jupiter-tools/stress-test\"]\nimage:https://codecov.io/gh/jupiter-tools/stress-test/branch/master/graph/badge.svg[link =\"https://codecov.io/gh/jupiter-tools/stress-test\"]\n\nTools to write stress tests and benchmarking with Junit5.\n\n## Getting started\n\nYou need to add the following dependency:\n\n[source, xml]\n----\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.jupiter-tools\u003c/groupId\u003e\n    \u003cartifactId\u003estress-test\u003c/artifactId\u003e\n    \u003cversion\u003e0.1\u003c/version\u003e\n    \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\n----\n\n### REST API stress testing\n\nLet's consider a simple web application :\n\nimage:./images/tasks.png[tasks application]\n\nHere we can create tasks and sub-tasks with titles,\nestimates, and weights(position in the list).\nWhen we create a sub-task we need to evaluate weight\nand set the next value for creating the task,\nbecause exists a unique constraint on the SubTask table in the database.\n\nIf we don't synchronize API then multiple concurrent requests\nmight let us to ConstraintViolationException.\n\nIn this case, StressTestRunner provide you an ability to check synchronization of your API:\n\n[source, java]\n----\n@Test\nvoid concurrentThreadsSubTasks() {\n    StressTestRunner.test()\n                    .mode(ExecutionMode.TASK_EXECUTOR_MODE)  \u003c1\u003e\n                    .timeout(5, TimeUnit.SECONDS) \u003c2\u003e\n                    .threads(4)   \u003c3\u003e\n                    .iterations(100)  \u003c4\u003e\n                    .run(this::createSubTaskSingleTest); \u003c5\u003e\n}\n\nprivate void createSubTaskSingleTest() throws Exception {\n\n    SubTask subTask = MvcRequester.on(mockMvc)\n                                  .to(\"tasks/{id}/subtasks/create\", TASK_ID)\n                                  .withParam(\"title\", \"Make it safe!\")\n                                  .withParam(\"estimate\", 30)\n                                  .post()\n                                  .expectStatus(HttpStatus.CREATED)\n                                  .returnAs(SubTask.class);\n\n    assertThat(subTask).isNotNull()\n                       .extracting(SubTask::getTitle, SubTask::getEstimate)\n                       .contains(\"Make it safe!\", 30);\n}\n----\n\u003c1\u003e test runner strategy (ThreadPoolExecutor based or Parallel Stream based)\n\u003c2\u003e time limit for tests passing\n\u003c3\u003e set threads count\n\u003c4\u003e set count of runs.\n\u003c5\u003e code of the one test iteration\n\n## JUnit5 Benchmark Extension\n\nWhen you need to compare a performance of multiple methods, you can use\nTestBenchmark extension:\n\n[source, java]\n----\n@EnableTestBenchmark  \u003c1\u003e\nclass EnableTestBenchmarkTest {\n\n    @Fast \u003c2\u003e\n    @TestBenchmark(measurementIterations = 15, warmupIterations = 10)  \u003c3\u003e\n    void testFast() throws InterruptedException {\n        Thread.sleep(30);\n    }\n\n    @TestBenchmark(measurementIterations = 15, warmupIterations = 10)\n    void testSlow() throws InterruptedException {\n        Thread.sleep(100);\n    }\n}\n----\n\u003c1\u003e enable test extension\n\u003c2\u003e mark as Fast method which you expect will be faster\n\u003c3\u003e set measurement and warm-up iterations\n\nExample of the benchmarking:\nimage:./images/benchmark.gif[live benchmarking]\n\nIf you measuring very fast methods (less than one milliseconds)\nyou can use `MeasureUnit` annotation to set a unit of measurement profiling:\n\n[source, java]\n----\n@EnableTestBenchmark\n@MeasureUnit(unit = TimeUnit.NANOSECONDS)\nclass BenchmarkExtensionMeasureUnitTest {\n\n    @Fast\n    @TestBenchmark(measurementIterations = 15, warmupIterations = 10)\n    void testFast() {\n    }\n\n    @TestBenchmark(measurementIterations = 15, warmupIterations = 10)\n    void testSlow() throws InterruptedException {\n        Thread.sleep(1);\n    }\n}\n----\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupiter-tools%2Fstress-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjupiter-tools%2Fstress-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupiter-tools%2Fstress-test/lists"}