0
votes

I was programming in netbeans using java, and everything was fine until suddenly tests were no longer being ran.I doubt its a programming error, because i am using netbeans to generate all the tests, and this problem seems to persist across projects. I've even tried reinstalling Netbeans. This is the output when i right click and press test-file.

> 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

I'm assuming its an gradle issue, here is the default gradle.build file on a new Netbeans project.

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


mainClassName = 'PleaseWork.Main'

repositories {
    jcenter()
}

dependencies {
    testCompile 'junit:junit:4.12'
}

It's driving me insane. Is there a workaround? Can i do something with the gradle.build file to force it to run tests?

1

1 Answers

0
votes

The problem is that Gradle uses a different class selector based on case. See Here

So if you simply change your package from "PleaseWork" to "pleaseWork" it will probably work.