I have inherited a Java project and am new to Java development. I feel a good way for me to get comfortable with the code is to write some tests around it. I\'m writing my c
I was getting this too:
junit.framework.AssertionFailedError: No tests found in ...
Solved by renaming the test method from method1
@Test
public void method1(){
// Do some stuff...
}
to testMethod1
@Test
public void testMethod1(){
// Do some stuff...
}
Test method name public void testName() {}
Where name() in source naming name methods.
I was getting this error, too:
junit.framework.AssertionFailedError: No tests found in ...
The reason was that I forgot to specify
defaultConfig {
...
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
After syncing the project, it found the tests. So maybe it helps someone else.
I bumped into the situation in JUnit 5
when created a private
method:
import org.junit.jupiter.api.Test
class Test1 {
@Test
private fun sort() {
println("1")
}
}
Remove private
.
if you are using jUnit 4 then not use extends TestCase, removing this fixed error.