diff --git a/docs/source/testing.rst b/docs/source/testing.rst index 93cd889533..24b7143f87 100644 --- a/docs/source/testing.rst +++ b/docs/source/testing.rst @@ -33,3 +33,47 @@ as follows: 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 +------------------------- + +We recommend 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 :ref:`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" + +.. _tutorial_cordapp_alternative_test_runners: + +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. + +.. note:: Before creating the IntelliJ run configurations for these unit tests + go to Run -> Edit Configurations -> Defaults -> JUnit, add + ``-javaagent:lib/quasar.jar`` + to the VM options, and set Working directory to ``$PROJECT_DIR$`` + so that the ``Quasar`` instrumentation is correctly configured. + +Add the following to your ``build.gradle`` file - ideally to a ``build.gradle`` that already contains the quasar-utils plugin line: + +.. sourcecode:: groovy + + 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``. \ No newline at end of file diff --git a/docs/source/tutorial-cordapp.rst b/docs/source/tutorial-cordapp.rst index eaa3b20fbb..f7d30e9e97 100644 --- a/docs/source/tutorial-cordapp.rst +++ b/docs/source/tutorial-cordapp.rst @@ -486,41 +486,7 @@ You can run the CorDapp's integration tests by running the ``Run Integration Tes Running tests in IntelliJ ~~~~~~~~~~~~~~~~~~~~~~~~~ -We recommend 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 :ref:`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" - -.. _tutorial_cordapp_alternative_test_runners: - -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. You will also need to specify ``-javaagent:lib/quasar.jar`` -and set the run directory to the project root directory for each test. - -Add the following to your ``build.gradle`` file - ideally to a ``build.gradle`` that already contains the quasar-utils plugin line: - -.. sourcecode:: groovy - - 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``. +See :ref:`Running tests in IntelliJ` Debugging your CorDapp ---------------------- diff --git a/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt b/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt index c2fcdc9da4..76994a826e 100644 --- a/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt +++ b/node/src/main/kotlin/net/corda/node/services/statemachine/SingleThreadedStateMachineManager.kt @@ -309,7 +309,7 @@ class SingleThreadedStateMachineManager( private fun checkQuasarJavaAgentPresence() { check(SuspendableHelper.isJavaAgentActive()) { """Missing the '-javaagent' JVM argument. Make sure you run the tests with the Quasar java agent attached to your JVM. - #See https://docs.corda.net/troubleshooting.html - 'Fiber classes not instrumented' for more details.""".trimMargin("#") + #See https://docs.corda.net/head/testing.html#running-tests-in-intellij - 'Fiber classes not instrumented' for more details.""".trimMargin("#") } }