问题
I newly replaced spongyCastle by bouncyCastle in an Android project:
implementation "org.bouncycastle:bcpkix-jdk15on:$project.bouncyCastleVersion"
Since then on Jenkins (our CI) it seems that there are tests being executed from this lib, could this be true? I never saw external libs with units tests executing automatically. The issue is now I see many failed tests, for example:
org.bouncycastle.pqc.crypto.qtesla.QTeslaKeyEncodingTests.testDecodeEncodePrivateKeyQT3P 27 ms 1
org.bouncycastle.pqc.crypto.qtesla.QTeslaKeyEncodingTests.testDecodeEncodePublicKeyQT3P
Is there a way to exlude al unit tets from an imported library in gradle?
回答1:
To exclude any unit test following can be used in build.gradle:
android {
testOptions {
unitTests {
all {
//exclude '**/QTeslaKeyEncodingTests.*'
exclude 'org.bouncycastle/**'
}
}
}
}
回答2:
Try changing your test command to this:
./gradlew --stacktrace testDebug --tests=your.package.name createDebugCoverageReport mergeAndroidReports --continue || true
回答3:
idk if it helps, but I had some issues with my CI related to spongy castle. I solved them by ignoring linting to its packages. In app.gradle, add:
lintOptions {
lintConfig file("lint.xml")
}
lint.xml
<lint>
<issue id="InvalidPackage">
<!-- ignore Invalid Package check for spongycastle -->
<ignore path="**/*spongycastle*.jar"/>
</issue>
</lint>
My problem was with linting, but you can probably ignore it for testing too.
来源:https://stackoverflow.com/questions/60284462/excluding-unit-tests-from-external-library