Reputation: 7426
I wrote a selenium sample test case in my application. Then I right click the file and select "Test File". It results
Testsuite: com.MyApp.SampleSeleniumTest
Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.265 sec
Testcase: warning(junit.framework.TestSuite$1): FAILED
No tests found in com.MyApp.SampleSeleniumTest
junit.framework.AssertionFailedError: No tests found in com.MyApp.SampleSeleniumTest
Test com.MyApp.SampleSeleniumTest FAILED
My code is
package com.MyApp;
import com.thoughtworks.selenium.*;
import org.junit.Test;
public class SampleSeleniumTest extends SeleneseTestCase {
@Override
public void setUp() throws Exception {
setUp("http://www.google.com", "*firefox");
}
@Test
public void whatever() throws Exception {
selenium.open("/");
assertTrue(selenium.isTextPresent("Explore"));
}
}
Upvotes: 0
Views: 712
Reputation: 1389
Here is an alternate way to do the same
package com.MyApp;
import com.thoughtworks.selenium.*;
import org.junit.*;
public class SampleSeleniumTest extends SeleneseTestCase {
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://urlofyourApp");
selenium.start();
}
@Test
public void testTestRC() throws Exception {
selenium.open("/");
assertTrue(selenium.isTextPresent("Explore"));
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
Upvotes: 1