From f3f50b2e179b686e2e5e7c59aeeee58c248886c2 Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Sun, 31 Dec 2017 21:14:40 +0300 Subject: [PATCH] add support to gradle to run tests on simulator --- README.md | 3 ++- build.gradle | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 332bed0..39ae239 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,13 @@ installed on the system. The gradle.properties file must contain the following p * im.status.gradle.gpshell.enc_key = the ENC key for the ISD * im.status.gradle.gpshell.kek_key = the KEK key for the ISD * im.status.gradle.gpshell.kvn = the Key Version Number for the ISD +* im.status.wallet.test.simulated = true if the test should run on the simulator, false (or anything else) otherwise Testing is done with JUnit and performed either on a real card or on [jCardSim](https://github.com/status-im/jcardsim). Although the tests are comprehensive, debugging on the real card is not easy because raw APDUs are not shown in the test log and there is no way to set breakpoints in the applet. -In order to test with the simulator, you need to pass these additional parameters to the JVM +In order to test with the simulator with an IDE, you need to pass these additional parameters to the JVM ```-noverify -Dim.status.wallet.test.simulated=true``` diff --git a/build.gradle b/build.gradle index 5d3095e..da5f1f7 100644 --- a/build.gradle +++ b/build.gradle @@ -73,10 +73,19 @@ task install(type: Exec) { standardInput new ByteArrayInputStream(gpShellScript.getBytes("UTF-8")) } -tasks.install.dependsOn(convertJavacard) -tasks.test.dependsOn(install) +if (project.properties['im.status.wallet.test.simulated'] != 'true') { + tasks.install.dependsOn(convertJavacard) + tasks.test.dependsOn(install) +} compileTestJava { sourceCompatibility = 1.8 targetCompatibility = 1.8 } + +afterEvaluate { + if (project.properties['im.status.wallet.test.simulated'] == 'true') { + def junitPlatformTestTask = tasks.getByName('junitPlatformTest') + junitPlatformTestTask.jvmArgs(['-noverify', '-Dim.status.wallet.test.simulated=true']) + } +}