{"id":18700666,"url":"https://github.com/manosbatsis/corda5-testutils","last_synced_at":"2025-11-08T22:30:32.416Z","repository":{"id":191486379,"uuid":"684600325","full_name":"manosbatsis/corda5-testutils","owner":"manosbatsis","description":"Test utilities for Corda 5 applications","archived":false,"fork":false,"pushed_at":"2024-01-30T09:45:35.000Z","size":190,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T05:22:03.228Z","etag":null,"topics":["automated-testing","corda","corda-developers","corda-framework","cordapp","cordapps","integration-test","integration-testing","integration-tests","junit","junit-jupiter","junit-test","junit5","test","test-automation","testing","testing-tools","tests"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manosbatsis.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":"2023-08-29T13:23:02.000Z","updated_at":"2024-01-16T09:22:04.000Z","dependencies_parsed_at":"2023-08-30T05:18:21.456Z","dependency_job_id":"3eb1b678-d899-4ab8-85ee-12f59a6b271b","html_url":"https://github.com/manosbatsis/corda5-testutils","commit_stats":{"total_commits":35,"total_committers":2,"mean_commits":17.5,"dds":"0.19999999999999996","last_synced_commit":"fe7e75052e909497a09799190afa0c9866802265"},"previous_names":["manosbatsis/corda5-testutils"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manosbatsis%2Fcorda5-testutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manosbatsis%2Fcorda5-testutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manosbatsis%2Fcorda5-testutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manosbatsis%2Fcorda5-testutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manosbatsis","download_url":"https://codeload.github.com/manosbatsis/corda5-testutils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239565650,"owners_count":19660154,"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":["automated-testing","corda","corda-developers","corda-framework","cordapp","cordapps","integration-test","integration-testing","integration-tests","junit","junit-jupiter","junit-test","junit5","test","test-automation","testing","testing-tools","tests"],"created_at":"2024-11-07T11:38:23.913Z","updated_at":"2025-11-08T22:30:32.369Z","avatar_url":"https://github.com/manosbatsis.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# corda5-testutils [![Maven Central](https://img.shields.io/maven-central/v/com.github.manosbatsis.corda5.testutils/integration-junit5.svg)](https://repo1.maven.org/maven2/com/github/manosbatsis/corda5/testutils/integration-junit5/) [![CI](https://github.com/manosbatsis/corda5-testutils/actions/workflows/gradle.yml/badge.svg)](https://github.com/manosbatsis/corda5-testutils/actions/workflows/gradle.yml)\n\nTest utilities for Corda 5 applications.\nAt the moment this project provides utilities for integration testing with the Corda 5 Combined Worker.\n\n## Prerequisites\n\nSame as [CSDE](https://docs.r3.com/en/tools-corda5/csde/prerequisites.html) \n\n- Azul Zulu JDK 17\n- Git ~v2.24.1\n- Docker Engine ~v20.X.Y or Docker Desktop ~v3.5.X\n- Corda CLI, see [Installing the Corda CLI](https://docs.r3.com/en/platform/corda/5.0/developing-applications/tooling/installing-corda-cli.html)\n\n### Gradle Dependencies\n\nIn your gradle:\n\n```groovy\n\n    testImplementation(\"com.github.manosbatsis.corda5.testutils:integration-junit5:$corda5testutilsVersion\")\n\n    testImplementation(\"org.junit.jupiter:junit-jupiter:$junitVersion\")\n    testRuntimeOnly(\"org.junit.jupiter:junit-jupiter-engine:$junitVersion\")\n```\n\n## Quick Howto\n\nThe JUnit5 extension will automatically launch, setup VNodes and (re)deploy CPIs \nto the Combined Worker as needed by default. The config exposes three modes:\n\n- SHARED: Default, described above. Leaves the worker running on finish.\n- PER_LAUNCHER: Will force a fresh Combined worker for the current JUnit LauncherSession. Stops the worker on finish.\n- PER_CLASS: Will force a fresh Combined worker for the current Test Class.\n- NONE: Completely disables automation for the Combined Worker to enable manual or external management.\n\n\n### Create a Test\n\nThe `Corda5NodesExtension` will retrieve the list of virtual nodes from the combined worker \nand expose them as a `NodeHandles` parameter to your test methods. Each node has basic info plus \nutility methods like `waitForFlow` that can be used to initiate flows and wait for a final flow status.\n\n```kotlin\nimport com.github.manosbatsis.corda5.testutils.integration.junit5.CombinedWorkerMode\nimport com.github.manosbatsis.corda5.testutils.integration.junit5.Corda5NodesConfig\nimport com.github.manosbatsis.corda5.testutils.integration.junit5.Corda5NodesExtension\nimport com.github.manosbatsis.corda5.testutils.integration.junit5.nodehandles.NodeHandles\nimport com.github.manosbatsis.corda5.testutils.rest.client.model.FlowRequest\nimport org.junit.jupiter.api.Test\nimport org.junit.jupiter.api.extension.ExtendWith\nimport kotlin.test.assertEquals\nimport kotlin.test.assertTrue\n\n// Add the Corda5 nodes extension\n@ExtendWith(Corda5NodesExtension::class)\nopen class DemoApplicationTests {\n\n    // Optional config for extension, values bellow are defaults\n    val config = Corda5NodesConfig(\n        authUsername = \"admin\",\n        authPassword = \"admin\",\n        baseUrl = \"https://localhost:8888/api/v1/\",\n        httpMaxWaitSeconds = 60,\n        debug = false,\n        projectDir = Corda5NodesConfig.gradleRootDir,\n        combinedWorkerMode = CombinedWorkerMode.SHARED,\n        // Optional, null by default\n        objectMapperConfigurer = { objectMapper: ObjectMapper -\u003e\n            objectMapper.registerModule(myModule)\n        }\n    )\n\n    // The Corda5NodesExtension provides the NodeHandles\n    @Test\n    fun workFlowTests(nodeHandles: NodeHandles) {\n        // Get node handles\n        val aliceNode = nodeHandles.getByCommonName(\"Alice\")\n        val bobNode = nodeHandles.getByCommonName(\"Bob\")\n\n        // Create flow args\n        val flowArgs = MyFirstFlowStartArgs(bobNode.memberX500Name)\n        // Call Flow\n        val response = aliceNode.waitForFlow(\n            FlowRequest(\n                flowClass = MyFirstFlow::class.java,\n                requestBody = flowArgs,\n                flowResultClass = Message::class.java\n            )\n        )\n\n        // Check status and deserialized flow result \n        assertTrue(response.isSuccess())\n        val expectedMessage = Message(bobNode.memberX500Name, \"Hello Alice, best wishes from Bob\")\n        assertEquals(expectedMessage, response.flowResult)\n    }\n}\n```\n\n## Github Action\n\nUsing Github for your CI? Check out [corda5-cli-action](https://github.com/manosbatsis/corda5-cli-action).\n\n## Examples\n\nYou can find a complete example built on top of CSDE at the [CSDE-cordapp-integration-testing](https://github.com/manosbatsis/CSDE-cordapp-integration-testing) repo.\nThere is also a relevant Medium article [here](https://medium.com/@manosbatsis/corda5-integration-testing-4e98d6a195cd). \n\n## Feedback\n\nIssues, PRs etc. welcome. You can also try pinging me on https://cordaledger.slack.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanosbatsis%2Fcorda5-testutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanosbatsis%2Fcorda5-testutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanosbatsis%2Fcorda5-testutils/lists"}