从外部库中排除单元测试

从外部库中排除单元测试

问题描述:

在一个Android项目中,我用bouncyCastle新替换了spongyCastle:

I newly replaced spongyCastle by bouncyCastle in an Android project:

implementation "org.bouncycastle:bcpkix-jdk15on:$project.bouncyCastleVersion"

自那时以来,似乎在詹金斯(我们的CI)上正在执行测试lib,这是真的吗?我从未见过带有自动执行的单元测试的外部库。现在的问题是,我看到许多失败的测试,例如:

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

是有没有办法从gradle中的导入库中排除所有单元tets?

Is there a way to exlude al unit tets from an imported library in gradle?

要排除任何单元测试,可以在 build.gradle

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

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