add support to gradle to run tests on simulator

This commit is contained in:
Michele Balistreri 2017-12-31 21:14:40 +03:00
parent 9003c35fcd
commit f3f50b2e17
2 changed files with 13 additions and 3 deletions

View File

@ -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```

View File

@ -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'])
}
}