从外部库中排除单元测试 [英] Excluding unit tests from external library

查看:133
本文介绍了从外部库中排除单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个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/**'
      }
    }
  }
}

这篇关于从外部库中排除单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆