Junit.framework.AssertionFailedError: tests not found in register

I had a problem making this test case work. Can someone point me in the right direction? I know that I am doing something wrong, I just do not know what.

import org.junit.*;
import com.thoughtworks.selenium.*;
import org.openqa.selenium.server.*;

@SuppressWarnings("deprecation")

public class register extends SeleneseTestCase {

  Selenium selenium;
  private SeleniumServer seleniumServer;
  public static final String MAX_WAIT = "60000";
  public final String CRN = "12761";

  public void setUp() throws Exception {
    RemoteControlConfiguration rc = new RemoteControlConfiguration();
    rc.setAvoidProxy(true);
    rc.setSingleWindow(true);
    rc.setReuseBrowserSessions(true);

    seleniumServer = new SeleniumServer(rc);
    selenium = new DefaultSelenium("localhost", 4444, "*firefox", "http://google.com/");
    seleniumServer.start();
    selenium.start();
  }

  @Test
  public void register_test() throws Exception {
    //TESTS IN HERE
  }

  @After
  public void tearDown() throws Exception {
    selenium.stop();
    // Thread.sleep(500000);
  }
}

And I get the following errors:

junit.framework.AssertionFailedError: No tests found in register
at jumnit.framework.TestSuite$1.runTest(TestSuite.java:97)

I'm at a dead end.

+3
source share
3 answers

You cannot extend TestCase (or SeleniumTestCase), nor use JUnit annotations (@Test). The testers for JUnit3 and 4 are different from each other, and my assumption is that JUnit sees that you have expanded TestCase, it uses an old runner.

Remove the @Test annotation and instead follow the old naming convention for your test with the word “test” with a prefix, and this will fix it.

public void testRegister() throws Exception {
  //TESTS IN HERE
}

PS. Java, .

. , .

+24

, , , ,

+2

, <junit> Ant, Ant 1.7 . Ant 1.7+ <classpath>, JUnit 4.x, , CodeSpelunker, @Test. http://ant.apache.org/faq.html#delegating-classloader .

+1

All Articles