Sitemap
Manos Batsis

Manos Batsis

Human with some experience.

Corda5 Integration Testing

2 min readJan 5, 2024

--

with Gradle, JUnit5, Corda5-Testutils and Corda5-CLI-Action

Press enter or click to view image in full size
Corda5 CLI in GitHub Actions

This is a quick HOWTO for Corda5 integration testing, both local and CI with GitHub Actions. You can find the working code in this CSDE fork, specifically in this PR.

Note: seems corda-runtime-os release-5.0.0 disappeared from GitHub. Our sample is based on CSDE release/corda-5–0, only updated to use Corda 5.0.1 and Java 17.

Prerequisites

Same as CSDE:

Gradle Setup

The corda5-testutils dependency includes a JUnit5 extension
for starting the Combined Worker and an API for calling flows etc.

Get Manos Batsis’s stories in your inbox

Join Medium for free to get updates from this writer.

Let’s add the dependency version to gradle.properties:

# Corda 5 Test Utils
corda5TestutilsVersion=1.2.1

Now into workflows/build.gradle, we add separate configuration, sourceSets etc. for integration tests:

And the corda5-testutils dependency for launching Corda’s Combined Worker:

Create a Test

Here’s how our Integration Test looks like:

Test with Gradle

We have to call integration tests explicitly:

./gradlew build integrationTest 

Test with GitHub Actions

The corda5-cli-action will download, install and cache the Corda5 CLI, so the Gradle build will just work. The workflow file contains the following:

You can see the workflow runs in the repository’s actions area.

Build Successful

All done. You can find the code in CSDE-cordapp-integration-testing

--

--