Search code examples
androidgradlebouncycastle

Excluding unit tests from external library


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?


Solution

  • To exclude any unit test following can be used in build.gradle:

    android {
      testOptions {
        unitTests {
          all {
            //exclude '**/QTeslaKeyEncodingTests.*'
            exclude 'org.bouncycastle/**'
          }
        }
      }
    }