Netbeans 11.2未找到测试

问题描述 投票:0回答:1

我当时使用Java在netbeans中编程,直到突然不再运行测试为止,一切都很好。我怀疑它是一个编程错误,因为我正在使用netbeans来生成所有测试,并且这个问题似乎在项目中仍然存在。我什至尝试重新安装Netbeans。这是我右键单击并按测试文件时的输出。

> Task :compileJava
> Task :processResources NO-SOURCE
> Task :classes
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> No tests found for given includes: [PleaseWork.ReturnValuesTest](--tests filter)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
3 actionable tasks: 3 executed

我假设这是一个问题,这是新的Netbeans项目上的默认gradle.build文件。

apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'application'


mainClassName = 'PleaseWork.Main'

repositories {
    jcenter()
}

dependencies {
    testCompile 'junit:junit:4.12'
}

这让我发疯。有解决方法吗?我可以用gradle.build文件做些什么来强迫它运行测试吗?

unit-testing gradle netbeans junit4
1个回答
0
投票

问题是Gradle根据大小写使用了不同的类选择器。 See Here

因此,如果您只是简单地将软件包从“ PleaseWork”更改为“ pleaseWork”,则可能会起作用。

© www.soinside.com 2019 - 2024. All rights reserved.