Importing the Framework
Adding the Framework as a Dependency
To use the framework with your CorDapp, add the following dependency to the build.gradle
file:
dependencies {
testImplementation 'com.r3.corda.ledger.utxo:contract-testing:2.0.0'
}
If your CorDapp is written in Kotlin, you can also add a Kotlin DSL framework, as follows:
dependencies {
testImplementation 'com.r3.corda.ledger.utxo:contract-testing:2.0.0'
testImplementation 'com.r3.corda.ledger.utxo:contract-testing-kotlin:2.0.0'
}
You can now extend the ContractTest
interface to create a test class for your smart contracts. Your contract test classes must inherit from the ContractTest
base class, as follows:
class ExampleIdentifiableContractCreateCommandTests : ContractTest() {
...
}
Testing with the Framework
All tests should extend ContractTest
as a starting point. The ContractTest
class provides functions to easily write contract tests, the UTXOLedgerService
and MockSigningService
classes, and also the following useful test data:
X.500 Legal Identities | Public Keys |
---|---|
aliceName | aliceKey |
bobName | bobKey |
charlieName | charlieKey |
daveName | daveKey |
eveName | eveKey |
bankAName | bankAKey |
bankBName | bankBKey |
notaryName | notaryKey |
Was this page helpful?
Thanks for your feedback!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.
We're sorry this page wasn't helpful. Let us know how we can make it better!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Create an issue
Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.