Testing your changes
Automated tests
Corda has a suite of tests that any contributing developers must maintain and extend when adding new code.
There are several test suites:
- Unit tests: These are traditional unit tests that should only test a single code unit, typically a method or class.
- Integration tests: These tests should test the integration of small numbers of units, preferably with mocked out services.
- Smoke tests: These are full end to end tests which start a full set of Corda nodes and verify broader behaviour.
- Other: These include tests such as performance tests, stress tests, etc, and may be in an external repo.
Running the automated tests
These tests are mostly written with JUnit and can be run via gradle
:
- Windows: Run
gradlew test integrationTest smokeTest
- Unix/macOS: Run
./gradlew test integrationTest smokeTest
Before creating a pull request please make sure these pass.
Manual testing
You should manually test anything that would be impacted by your changes. The areas that usually need to be manually tested and when are as follows:
- Node startup - changes in the
node
ornode:capsule
project in both the Kotlin or gradle or thecordformation
gradle plugin. - Sample project - changes in the
samples
project. eg; changing the IRS demo means you should manually test the IRS demo. - Explorer - changes to the
tools/explorer
project.
How to manually test each of these areas differs and is currently not fully specified. For now the best thing to do is to ensure the program starts, that you can interact with it, and that no exceptions are generated in normal operation.
Running tests in IntelliJ
R3 recommends editing your IntelliJ preferences so that you use the Gradle runner - this means that the quasar utils
plugin will make sure that some flags (like -javaagent
- see below) are
set for you.
To switch to using the Gradle runner:
Navigate to
Build, Execution, Deployment -> Build Tools -> Gradle -> Runner
(or search for runner)- Windows: this is in “Settings”
- macOS: this is in “Preferences”
Set “Delegate IDE build/run actions to gradle” to true
Set “Run test using:” to “Gradle Test Runner”
If you would prefer to use the built in IntelliJ JUnit test runner, you can add some code to your build.gradle
file and
it will copy your quasar JAR file to the lib directory.
-javaagent:lib/quasar.jar
to the VM options, and set Working directory to $PROJECT_DIR$
so that the Quasar
instrumentation is correctly configured.build.gradle
file - ideally to a build.gradle
that already contains the quasar-utils plugin line:apply plugin: 'net.corda.plugins.quasar-utils'
task installQuasar(type: Copy) {
destinationDir rootProject.file("lib")
from(configurations.quasar) {
rename 'quasar-core(.*).jar', 'quasar.jar'
}
}
and then you can run gradlew installQuasar
.
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.