Junit4 giving "no tests found" when running junit on simple test cases
By Gabriel Cooper •
I need some help getting junit4 working on ubuntu 14.04. I have installed junit correctly (I hope!), when I use junit -v in the terminal it returns junit 4.11. However when I compile with javac: javac TestCase.java and the run junit TestCase it returns no tests found.
My simple test code is:
import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class ClubMemberTest{ @Test public void test1(){ assertTrue(1-1==0); } }I have put junit4.jar and junit4-4.11.jar in my CLASSPATH variable using the .bashrc file.
I'm still pretty new to linux & ubuntu so any and all help would be greatly appreciated!
01 Answer
Of course not. Your class ClubMemberTest have to extend junit.framework.TestCase
import org.junit.Test;
import junit.framework.TestCase;
public class ClubMemberTest extends TestCase { @Test public static void test1() { assertTrue(1 - 1 == 0); }
} 1 More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"