|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
com.thoughtworks.selenium.SeleneseTestCase
public class SeleneseTestCase
Provides a JUnit TestCase base class that implements some handy functionality for Selenium testing (you are not required to extend this class).
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.
Field Summary | |
---|---|
protected Selenium |
selenium
Use this object to run all of your selenium tests |
Constructor Summary | |
---|---|
SeleneseTestCase()
|
|
SeleneseTestCase(java.lang.String name)
|
Method Summary | |
---|---|
static void |
assertEquals(java.lang.Object s1,
java.lang.Object s2)
Like JUnit's Assert.assertEquals, but knows how to compare string arrays |
static void |
assertEquals(java.lang.String[] s1,
java.lang.String[] s2)
Asserts that two string arrays have identical string contents |
static void |
assertEquals(java.lang.String s1,
java.lang.String s2)
Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese |
static void |
assertEquals(java.lang.String s1,
java.lang.String[] s2)
Like JUnit's Assert.assertEquals, but joins the string array with commas, and handles "regexp:" strings like HTML Selenese |
static void |
assertNotEquals(boolean b1,
boolean b2)
Asserts that two booleans are not the same |
static void |
assertNotEquals(java.lang.Object obj1,
java.lang.Object obj2)
Asserts that two objects are not the same (compares using .equals()) |
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 |
java.lang.String |
getText()
Returns the body text of the current page |
protected boolean |
isCaptureScreetShotOnFailure()
|
void |
pause(int millisecs)
Sleeps for the specified number of milliseconds |
void |
runBare()
Runs the bare test sequence, capturing a screenshot if a test fails |
static boolean |
seleniumEquals(java.lang.Object expected,
java.lang.Object actual)
Compares two objects, but handles "regexp:" strings like HTML Selenese |
static boolean |
seleniumEquals(java.lang.String expectedPattern,
java.lang.String actual)
Compares two strings, but handles "regexp:" strings like HTML Selenese |
protected void |
setCaptureScreetShotOnFailure(boolean captureScreetShotOnFailure)
|
void |
setUp()
Calls this.setUp(null) |
void |
setUp(java.lang.String url)
Calls this.setUp with the specified url and a default browser. |
void |
setUp(java.lang.String url,
java.lang.String browserString)
Creates a new DefaultSelenium object and starts it using the specified baseUrl and browser string |
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(java.lang.Object s1,
java.lang.Object s2)
Like assertEquals, but fails at the end of the test (during tearDown) |
void |
verifyEquals(java.lang.String[] s1,
java.lang.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(java.lang.Object s1,
java.lang.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) |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Selenium selenium
Constructor Detail |
---|
public SeleneseTestCase()
public SeleneseTestCase(java.lang.String name)
Method Detail |
---|
public void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
setUp(String)
public void runBare() throws java.lang.Throwable
runBare
in class junit.framework.TestCase
java.lang.Throwable
- if any exception is thrownpublic void setUp(java.lang.String url) throws java.lang.Exception
url
- the baseUrl to use for your Selenium tests
java.lang.Exception
setUp(String, String)
public void setUp(java.lang.String url, java.lang.String browserString) throws java.lang.Exception
url
- the baseUrl for your testsbrowserString
- the browser to use, e.g. *firefox
java.lang.Exception
public void verifyTrue(boolean b)
public void verifyFalse(boolean b)
public java.lang.String getText()
public void verifyEquals(java.lang.Object s1, java.lang.Object s2)
public void verifyEquals(boolean s1, boolean s2)
public static void assertEquals(java.lang.Object s1, java.lang.Object s2)
public static void assertEquals(java.lang.String s1, java.lang.String s2)
public static void assertEquals(java.lang.String s1, java.lang.String[] s2)
public static boolean seleniumEquals(java.lang.String expectedPattern, java.lang.String actual)
expectedPattern
- actual
-
public static boolean seleniumEquals(java.lang.Object expected, java.lang.Object actual)
seleniumEquals(String, String)
public static void assertEquals(java.lang.String[] s1, java.lang.String[] s2)
public void verifyEquals(java.lang.String[] s1, java.lang.String[] s2)
public void verifyNotEquals(java.lang.Object s1, java.lang.Object s2)
public void verifyNotEquals(boolean s1, boolean s2)
public static void assertNotEquals(java.lang.Object obj1, java.lang.Object obj2)
public static void assertNotEquals(boolean b1, boolean b2)
public void pause(int millisecs)
public void checkForVerificationErrors()
public void clearVerificationErrors()
public void tearDown() throws java.lang.Exception
tearDown
in class junit.framework.TestCase
java.lang.Exception
protected boolean isCaptureScreetShotOnFailure()
protected void setCaptureScreetShotOnFailure(boolean captureScreetShotOnFailure)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |