{"id":25776823,"url":"https://github.com/vmlens/vmlens","last_synced_at":"2026-01-14T02:13:13.714Z","repository":{"id":60579841,"uuid":"281382519","full_name":"vmlens/vmlens","owner":"vmlens","description":"Deterministic Unit Tests for Multithreaded Java","archived":false,"fork":false,"pushed_at":"2026-01-02T15:41:49.000Z","size":10287,"stargazers_count":137,"open_issues_count":3,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-08T23:18:51.704Z","etag":null,"topics":["asynchronous","concurrency","concurrent","concurrent-programming","java","multithreading","testing"],"latest_commit_sha":null,"homepage":"https://vmlens.com","language":"Java","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/vmlens.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-07-21T11:46:23.000Z","updated_at":"2026-01-02T15:40:53.000Z","dependencies_parsed_at":"2025-06-20T15:29:13.582Z","dependency_job_id":"c95cb7b5-d80b-49c2-9835-8f678fc0a0e2","html_url":"https://github.com/vmlens/vmlens","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/vmlens/vmlens","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmlens%2Fvmlens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmlens%2Fvmlens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmlens%2Fvmlens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmlens%2Fvmlens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmlens","download_url":"https://codeload.github.com/vmlens/vmlens/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmlens%2Fvmlens/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["asynchronous","concurrency","concurrent","concurrent-programming","java","multithreading","testing"],"created_at":"2025-02-27T06:01:31.769Z","updated_at":"2026-01-14T02:13:13.707Z","avatar_url":"https://github.com/vmlens.png","language":"Java","readme":"# Deterministic Unit Tests for Multithreaded Java\n\n# Example\n\nThe following example shows how to test multithreaded, concurrent Java with vmlens:\n\n```Java\nimport com.vmlens.api.AllInterleavings;\npublic class TestNonVolatileField {\n    private int j = 0;\n    @Test\n    public void testUpdate() throws InterruptedException {\n        try(AllInterleavings allInterleavings = new AllInterleavings(\"testNonVolatileField\")) {\n            while (allInterleavings.hasNext()) {\n                Thread first = new Thread() {\n                    @Override\n                    public void run() {\n                        j++;\n                    }\n                };\n                first.start();\n                j++;\n                first.join();\n            }\n        }\n    }\n}\n```\nVMLens detects the data race and generates the following report:\n\n\u003cimg style=\" width: 100%; height: auto; margin-right : auto; margin-left : auto; min-width : 300px; border-radius: 10px; border: 2px solid #4198ff;\" src=\"https://vmlens.com/images/dataRaceReport.svg\"\u003e\n\nSee [test-vmlens-maven-plugin](https://github.com/vmlens/vmlens/tree/master/test-vmlens-maven-plugin/src/test/java/com/vmlens/test/maven/plugin) for more examples.\n\n# Installation\n\n## Maven\n\nTo use vmlens with Maven, configure a plugin tag to tell Maven that the vmlens plugin should be executed at the test phase. And include the jar com.vmlens.api as test dependency.\n\n```XML\n\u003cproject\u003e\n\u003c!-- to include the class AllInterleavings into the test class path.  --\u003e\t\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.vmlens\u003c/groupId\u003e\n  \u003cartifactId\u003eapi\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.24\u003c/version\u003e\n  \u003cscope\u003etest\u003c/scope\u003e\n\u003c/dependency\u003e\t\n\t\n\u003cbuild\u003e\n  \u003cplugins\u003e\n\u003c!-- to run the vmlens maven plugin during the maven test phase  --\u003e\t \n    \u003cplugin\u003e\n        \u003cgroupId\u003ecom.vmlens\u003c/groupId\u003e\n        \u003cartifactId\u003evmlens-maven-plugin\u003c/artifactId\u003e\n        \u003cversion\u003e1.2.24\u003c/version\u003e\n        \u003cexecutions\u003e\n            \u003cexecution\u003e\n                \u003cid\u003etest\u003c/id\u003e\n                \u003cgoals\u003e\n                    \u003cgoal\u003etest\u003c/goal\u003e\n                \u003c/goals\u003e\n            \u003c/execution\u003e\n        \u003c/executions\u003e\n\t\u003c/plugin\u003e\n     ...\n    \u003c/plugins\u003e\n\u003c/build\u003e\n      ...\n\u003c/project\u003e\n```\n\nSee [pom.xml](https://github.com/vmlens/vmlens/blob/master/test-vmlens-maven-plugin/pom.xml) for an example.\n\n## Gradle\nTo use VMLens with Gradle add the java agent as vm parameter for the test and process the events after the test run to create the VMLens Report:\n\n```Java\nimport com.vmlens.gradle.VMLens\nplugins {\n  ...\n}\nrepositories {\n    mavenCentral()\n}\ndependencies {\n    testImplementation(\"com.vmlens:api:1.2.24\")\n    ...\n}\nbuildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath(\"com.vmlens:standalone:1.2.24\")\n    }\n}\ntasks.register(\"vmlensReport\") {\n    doLast {\n        VMLens().process(layout.buildDirectory.getAsFile().get());\n    }\n}\ntasks.test {\n    doFirst{\n        jvmArgs(VMLens().setup(layout.buildDirectory.getAsFile().get()))\n    }\n    // VMLens currently does not work with jacoco\n    jvmArgumentProviders.removeIf { it::class.java.simpleName == \"JacocoAgent\" }\n    useJUnitPlatform()\n    finalizedBy(\"vmlensReport\")\n}\n```\n\nSee [build.gradle.kts](https://github.com/vmlens/vmlens-examples/blob/master/build.gradle.kts) for an example.\n\n## Standalone\n\nTo use VMLens as a standalone tool:\n\n1. Include com.vmlens.api from the [Maven Repository](https://repo1.maven.org/maven2/com/vmlens/api/1.2.24/) as a test jar in your project.\n1. Download the jar standalone-1.2.24.jar from the [Maven Repository](https://repo1.maven.org/maven2/com/vmlens/standalone/1.2.24/) \n1. Run java -jar standalone-1.2.24.jar install. This creates the agent directory and prints the vm parameter to System.out\n1. Add this vm parameter when you run your test\n2. Run java -jar standalone-1.2.24.jar report. This checks for data races and creates the report\n\n# Supported Java Versions\n\nVMLens runs with JDK 9 to 25\n\n\n# Documentation\n\nRead the documentation [here](https://vmlens.com/docs/).\n\n# Questions? Problems? Suggestions?\n\nContact me at [thomas.krieger@vmlens.com](mailto:thomas.krieger@vmlens.com)\n\n\n# License\n\n[Apache License 2.0](https://github.com/vmlens/vmlens/blob/master/LICENSE)\n\n\n\n\n","funding_links":[],"categories":["测试"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmlens%2Fvmlens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmlens%2Fvmlens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmlens%2Fvmlens/lists"}