Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when running Corda flow tests from IntelliJ

Tags:

corda

When I run Corda flow tests from IntelliJ, the tests fail with the following errors:

QUASAR WARNING: Quasar Java Agent isn't running. If you're using another instrumentation method you can ignore this message; otherwise, please refer to the Getting Started section in the Quasar documentation.

and

java.lang.IllegalStateException: 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.

How can I fix this?

like image 555
Joel Avatar asked Nov 21 '17 10:11

Joel


2 Answers

Corda flows need to be instrumented using Quasar before they are run, so that they can be suspended mid-execution.

To achieve this in IntelliJ, you need to:

  • Create a run config for your tests
  • Open the run config and change the VM options to -ea -javaagent:PATH-TO-QUASAR-JAR
    • In the CorDapp example and templates, quasar.jar is located at lib/quasar.jar, so you'd use -ea -javaagent:../lib/quasar.jar

Alternatively, you can edit the default JUnit run config to use the Quasar javaagent by default, avoiding you having to do this every time you pick a new test to run.

like image 149
Joel Avatar answered Oct 23 '22 10:10

Joel


This is a basic error that you get if you don't set Quasar, you need to select your test-> go to Intellij top bar-> Run -> Edit Configurations and then set up like this photo in VM options: enter image description here

like image 34
Stefano.Maffullo Avatar answered Oct 23 '22 09:10

Stefano.Maffullo