Reputation: 8846
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"));
.....
Upvotes: 6
Views: 12926
Reputation: 37816
As SeleneseTestCase is deprecated, you can use SeleneseTestBase instead of SeleneseTestCase. The java code for this as below:
import com.thoughtworks.selenium.SeleneseTestBase;
public class MySeleniumTest extends SeleneseTestBase{
@Test
public void aMethod(){
verifyTrue(boolean condition);
}
}
If you don't extends SeleneseTestBase class you can use an object as below:
new SeleneseTestBase().verifyTrue(boolean condition);
Upvotes: 1
Reputation: 8679
I think the idea is for you to use JUnit's Assert.assertXXX()
the difference is that verifyXXX
will 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).
Upvotes: 2