When I use the code generated by the JUnit 4 formatter in the Selenium IDE, I get warnings that the class SeleneseTestCase is deprecated – makes sense since it’s supposed to b JUnit 4 syntax and use annotations instead of deriving from a test class.
The issue is when I modify my code to not extend SeleneseTestCase I’m not sure how to call the verify* methods – they appear to only exist in the deprecated class. I can run my selenium actions using the code below but verifyTrue is undefined. What is the correct way to call the verify methods in Selenium 2.0b2?
private static Selenium selenium;
@Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://testurl.com/");
selenium.start();
}
@Test
public void testLogin() throws Exception {
selenium.open("/test.html");
verifyTrue(selenium.isTextPresent("Please Sign In"));
.....
I think the idea is for you to use JUnit’s
Assert.assertXXX()the difference is thatverifyXXXwill fail during teardown instead of immediately but I think with Selenium tests you usually want to fail as fast as possible (since those tests tend to be slow).