Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.thoughtworks.selenium
Class SeleneseTestCase

    java.lang.Object
      junit.framework.Assert
          junit.framework.TestCase
              com.thoughtworks.selenium.SeleneseTestCase

All Implemented Interfaces:
  junit.framework.Test

    public class SeleneseTestCase

extends junit.framework.TestCase

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.

Author:
  Nelson Sproul (nsproul@bea.com) Mar 13-06

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` | `isCaptureScreenShotOnFailure()`
`protected boolean` | `isCaptureScreetShotOnFailure()` Deprecated. Use `isCaptureScreenShotOnFailure()` instead
`java.lang.String` | `join(java.lang.String[] array, char c)`
`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
`protected java.lang.String` | `runtimeBrowserString()`
`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 expected, java.lang.String actual)` Compares two strings, but handles "regexp:" strings like HTML Selenese
`protected void` | `setCaptureScreenShotOnFailure(boolean b)`
`protected void` | `setCaptureScreetShotOnFailure(boolean b)` Deprecated. Use `setCaptureScreenShotOnFailure(boolean)` instead
`protected void` | `setTestContext()`
`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 arg1, boolean arg2)` 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)` Like assertEquals, but 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, format`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### selenium

    protected Selenium selenium

  Use this object to run all of your selenium tests

Constructor Detail

### SeleneseTestCase

    public SeleneseTestCase()

### SeleneseTestCase

    public SeleneseTestCase(java.lang.String name)

Method Detail

### checkForVerificationErrors

    public void checkForVerificationErrors()

  Asserts that there were no verification errors during the current test, failing immediately if any are found

### clearVerificationErrors

    public void clearVerificationErrors()

  Clears out the list of verification errors

### getText

    public java.lang.String getText()

  Returns the body text of the current page

### pause

    public void pause(int millisecs)

  Sleeps for the specified number of milliseconds

### setUp

    public void setUp()
               throws java.lang.Exception

  Calls this.setUp(null)

  Overrides:
    `setUp` in class `junit.framework.TestCase`
  Throws:
    `java.lang.Exception`
  See Also:
    `setUp(String)`

### setUp

    public void setUp(java.lang.String url)
               throws java.lang.Exception

  Calls this.setUp with the specified url and a default browser. On Windows, the default browser is *iexplore; otherwise, the default browser is *firefox.

  Parameters:
    `url` - the baseUrl to use for your Selenium tests
  Throws:
    `java.lang.Exception`
  See Also:
    `setUp(String, String)`

### setUp

    public void setUp(java.lang.String url,
                      java.lang.String browserString)
               throws java.lang.Exception

  Creates a new DefaultSelenium object and starts it using the specified baseUrl and browser string

  Parameters:
    `url` - the baseUrl for your tests
    `browserString` - the browser to use, e.g. *firefox
  Throws:
    `java.lang.Exception`

### tearDown

    public void tearDown()
                  throws java.lang.Exception

  checks for verification errors and stops the browser

  Overrides:
    `tearDown` in class `junit.framework.TestCase`
  Throws:
    `java.lang.Exception`

### verifyEquals

    public void verifyEquals(boolean arg1,
                             boolean arg2)

  Like assertEquals, but fails at the end of the test (during tearDown)

### verifyEquals

    public void verifyEquals(java.lang.Object s1,
                             java.lang.Object s2)

  Like assertEquals, but fails at the end of the test (during tearDown)

### verifyEquals

    public void verifyEquals(java.lang.String[] s1,
                             java.lang.String[] s2)

  Like assertEquals, but fails at the end of the test (during tearDown)

### verifyFalse

    public void verifyFalse(boolean b)

  Like assertFalse, but fails at the end of the test (during tearDown)

### verifyNotEquals

    public void verifyNotEquals(boolean s1,
                                boolean s2)

  Like assertNotEquals, but fails at the end of the test (during tearDown)

### verifyNotEquals

    public void verifyNotEquals(java.lang.Object s1,
                                java.lang.Object s2)

  Like assertNotEquals, but fails at the end of the test (during tearDown)

### verifyTrue

    public void verifyTrue(boolean b)

  Like assertTrue, but fails at the end of the test (during tearDown)

### assertEquals

    public static void assertEquals(java.lang.Object s1,
                                    java.lang.Object s2)

  Like JUnit's Assert.assertEquals, but knows how to compare string arrays

### assertEquals

    public static void assertEquals(java.lang.String s1,
                                    java.lang.String s2)

  Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese

### assertEquals

    public 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

### assertEquals

    public static void assertEquals(java.lang.String[] s1,
                                    java.lang.String[] s2)

  Asserts that two string arrays have identical string contents

### assertNotEquals

    public static void assertNotEquals(boolean b1,
                                       boolean b2)

  Asserts that two booleans are not the same

### assertNotEquals

    public static void assertNotEquals(java.lang.Object obj1,
                                       java.lang.Object obj2)

  Asserts that two objects are not the same (compares using .equals())

### seleniumEquals

    public static boolean seleniumEquals(java.lang.Object expected,
                                         java.lang.Object actual)

  Compares two objects, but handles "regexp:" strings like HTML Selenese

  Returns:
    true if actual matches the expectedPattern, or false otherwise
  See Also:
    `seleniumEquals(String, String)`

### seleniumEquals

    public static boolean seleniumEquals(java.lang.String expected,
                                         java.lang.String actual)

  Compares two strings, but handles "regexp:" strings like HTML Selenese

  Parameters:
    `expectedPattern` -
    `actual` -
  Returns:
    true if actual matches the expectedPattern, or false otherwise

### isCaptureScreetShotOnFailure

    protected boolean isCaptureScreetShotOnFailure()

  Deprecated. Use `isCaptureScreenShotOnFailure()` instead

### isCaptureScreenShotOnFailure

    protected boolean isCaptureScreenShotOnFailure()

### runtimeBrowserString

    protected java.lang.String runtimeBrowserString()

### setCaptureScreetShotOnFailure

    protected void setCaptureScreetShotOnFailure(boolean b)

  Deprecated. Use `setCaptureScreenShotOnFailure(boolean)` instead

### setCaptureScreenShotOnFailure

    protected void setCaptureScreenShotOnFailure(boolean b)

### setTestContext

    protected void setTestContext()

### runBare

    public void runBare()
                 throws java.lang.Throwable

  Runs the bare test sequence, capturing a screenshot if a test fails

  Overrides:
    `runBare` in class `junit.framework.TestCase`
  Throws:
    `java.lang.Throwable` - if any exception is thrown

### join

    public java.lang.String join(java.lang.String[] array,
                                 char c)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009. All Rights Reserved.