selenium – junit. framework. Assertionfailederror: test not found in register
•
Java
I had a problem making this test case work Who can point me in the right direction? I know what I did wrong. I just don't know what it was
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 received the following errors:
junit.framework.AssertionFailedError: No tests found in register at jumnit.framework.TestSuite$1.runTest(TestSuite.java:97)
I'm sorry.
Solution
You cannot extend testcase (or selenium testcase) and use JUnit annotation (@ test) at the same time The test running programs of JUnit 3 and 4 are different. My assumption is that JUnit uses the old running program when it sees that you have extended testcase
Remove the @ test annotation instead of following the old convention of naming tests, prefixed with "test", which will resolve it
public void testRegister() throws Exception { //TESTS IN HERE }
PS. I suggest following more standard Java Naming Conventions, such as hump bushing
PPS. This is a link that explains this in more detail
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码