public class SeleneseTestBase extends Object
This class adds a number of "verify" commands, which are like "assert" commands, but they don't stop the test when they fail. Instead, verification errors are all thrown at once during tearDown.
Modifier and Type | Field and Description |
---|---|
protected Selenium |
selenium
Use this object to run all of your selenium tests
|
protected StringBuffer |
verificationErrors |
Constructor and Description |
---|
SeleneseTestBase() |
Modifier and Type | Method and Description |
---|---|
static void |
assertEquals(Object s1,
Object s2)
Like JUnit's Assert.assertEquals, but knows how to compare string arrays
|
static void |
assertEquals(String[] s1,
String[] s2)
Asserts that two string arrays have identical string contents
|
static void |
assertEquals(String s1,
String s2)
Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese
|
static void |
assertEquals(String s1,
String[] s2)
Like JUnit's Assert.assertEquals, but joins the string array with commas, and
handles "regexp:" strings like HTML Selenese
|
static void |
assertFalse(boolean condition) |
static void |
assertFalse(String message,
boolean condition) |
static void |
assertNotEquals(boolean b1,
boolean b2)
Asserts that two booleans are not the same
|
static void |
assertNotEquals(Object obj1,
Object obj2)
Asserts that two objects are not the same (compares using .equals())
|
static void |
assertTrue(boolean condition) |
static void |
assertTrue(String message,
boolean condition) |
void |
checkForVerificationErrors()
Asserts that there were no verification errors during the current test, failing immediately if any are found
|
void |
clearVerificationErrors()
Clears out the list of verification errors
|
static void |
fail(String message) |
String |
getText()
Returns the body text of the current page
|
protected boolean |
isCaptureScreenShotOnFailure() |
static String |
join(String[] sa,
char c) |
void |
pause(int millisecs)
Sleeps for the specified number of milliseconds
|
protected String |
runtimeBrowserString() |
static boolean |
seleniumEquals(Object expected,
Object actual)
Compares two objects, but handles "regexp:" strings like HTML Selenese
|
static boolean |
seleniumEquals(String expectedPattern,
String actual)
Compares two strings, but handles "regexp:" strings like HTML Selenese
|
protected void |
setCaptureScreenShotOnFailure(boolean captureScreetShotOnFailure) |
void |
setUp()
Calls this.setUp(null)
|
void |
setUp(String url)
Calls this.setUp with the specified url and a default browser.
|
void |
setUp(String url,
String browserString)
Creates a new DefaultSelenium object and starts it using the specified
baseUrl and browser string.
|
void |
setUp(String url,
String browserString,
int port) |
void |
tearDown()
checks for verification errors and stops the browser
|
void |
verifyEquals(boolean s1,
boolean s2)
Like assertEquals, but fails at the end of the test (during tearDown)
|
void |
verifyEquals(Object s1,
Object s2)
Like assertEquals, but fails at the end of the test (during tearDown)
|
void |
verifyEquals(String[] s1,
String[] s2)
Asserts that two string arrays have identical string contents (fails at the end of the test, during tearDown)
|
void |
verifyFalse(boolean b)
Like assertFalse, but fails at the end of the test (during tearDown)
|
void |
verifyNotEquals(boolean s1,
boolean s2)
Like assertNotEquals, but fails at the end of the test (during tearDown)
|
void |
verifyNotEquals(Object s1,
Object s2)
Like assertNotEquals, but fails at the end of the test (during tearDown)
|
void |
verifyTrue(boolean b)
Like assertTrue, but fails at the end of the test (during tearDown)
|
protected Selenium selenium
protected StringBuffer verificationErrors
public void setUp() throws Exception
Exception
setUp(String)
public void setUp(String url) throws Exception
url
- the baseUrl to use for your Selenium testsException
setUp(String, String)
protected String runtimeBrowserString()
public void setUp(String url, String browserString) throws Exception
url
- the baseUrl for your testsbrowserString
- the browser to use, e.g. *firefoxException
setUp(String, String, int)
public void verifyTrue(boolean b)
public void verifyFalse(boolean b)
public String getText()
public void verifyEquals(Object s1, Object s2)
public void verifyEquals(boolean s1, boolean s2)
public static void assertEquals(Object s1, Object s2)
public static void assertEquals(String s1, String s2)
public static void assertEquals(String s1, String[] s2)
public static boolean seleniumEquals(String expectedPattern, String actual)
expectedPattern
- actual
- public static boolean seleniumEquals(Object expected, Object actual)
seleniumEquals(String, String)
public static void assertEquals(String[] s1, String[] s2)
public void verifyEquals(String[] s1, String[] s2)
public void verifyNotEquals(Object s1, Object s2)
public void verifyNotEquals(boolean s1, boolean s2)
public static void assertNotEquals(Object obj1, Object obj2)
public static void fail(String message)
public static void assertTrue(String message, boolean condition)
public static void assertTrue(boolean condition)
public static void assertFalse(String message, boolean condition)
public static void assertFalse(boolean condition)
public static void assertNotEquals(boolean b1, boolean b2)
public void pause(int millisecs)
public void checkForVerificationErrors()
public void clearVerificationErrors()
public void tearDown() throws Exception
Exception
protected boolean isCaptureScreenShotOnFailure()
protected void setCaptureScreenShotOnFailure(boolean captureScreetShotOnFailure)
Copyright © 2012. All Rights Reserved.