现在,随着JUnit 5.0的发布,我正在努力使用jacoco来获取代码覆盖数据。Gradle,Android,Jacoco和JUnit5
我的项目是多模块,我的问题是没有为每个模块创建的exec文件。只有一个在根项目中(这似乎几乎是空的)。我一直无法找到最新的指南。
我试过这里描述的不同方法:Gradle Jacoco and JUnit5没有任何成功。
有没有人有与JUnit5和Jacoco的多模块(非Android)Gradle项目中的工作设置?
还是一个带有JUnit5和Jacoco的Gradle Android项目?任何意见是极大的赞赏。即使有一些官方文档可用,也欢迎丑陋的黑客。我的代码(无论是在命令行,并从IDE至少在运行JUnit5作品)
相关部分:
<Root> build.gradle:
buildscript {
dependencies {
...
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.0"
}
}
...
apply plugin: 'org.junit.platform.gradle.plugin'
ext.junitVintageVersion = '4.12.0'
ext.junitPlatformVersion = '1.0.0'
ext.junitJupiterVersion = '5.0.0'
subprojects {
apply plugin: "jacoco"
jacoco {
toolVersion = "0.7.6.201602180812"
}
...
junitPlatform {
filters {
engines {
include 'junit-jupiter', 'junit-vintage'
}
tags {
exclude 'slow'
}
includeClassNamePatterns '.*Test', '.*Tests'
}
}
}
...
dependencies {
// org.junit.platform.commons.util.PreconditionViolationException:
// Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
testCompile("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
}
当然,我忘了。我仍然努力工作。至少我越来越近了:https://github.com/aurae/android-junit5/issues/4 – Alix
不得不删除评论,因为它引用了错误的问题 – Alix