Class SeleneseTestCase

  • All Implemented Interfaces:
    junit.framework.Test

    @Deprecated
    public class SeleneseTestCase
    extends junit.framework.TestCase
    Deprecated.
    Please consider updating to junit 4 or above
    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

      Fields 
      Modifier and Type Field Description
      protected Selenium selenium
      Deprecated.
      Use this object to run all of your selenium tests
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void assertEquals​(java.lang.Object s1, java.lang.Object s2)
      Deprecated.
      Like JUnit's Assert.assertEquals, but knows how to compare string arrays
      static void assertEquals​(java.lang.String[] s1, java.lang.String[] s2)
      Deprecated.
      Asserts that two string arrays have identical string contents
      static void assertEquals​(java.lang.String s1, java.lang.String s2)
      Deprecated.
      Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese
      static void assertEquals​(java.lang.String s1, java.lang.String[] s2)
      Deprecated.
      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)
      Deprecated.
      Asserts that two booleans are not the same
      static void assertNotEquals​(java.lang.Object obj1, java.lang.Object obj2)
      Deprecated.
      Asserts that two objects are not the same (compares using .equals())
      void checkForVerificationErrors()
      Deprecated.
      Asserts that there were no verification errors during the current test, failing immediately if any are found
      void clearVerificationErrors()
      Deprecated.
      Clears out the list of verification errors
      java.lang.String getText()
      Deprecated.
       
      protected boolean isCaptureScreenShotOnFailure()
      Deprecated.
       
      java.lang.String join​(java.lang.String[] array, char c)
      Deprecated.
       
      void pause​(int millisecs)
      Deprecated.
      Sleeps for the specified number of milliseconds
      void runBare()
      Deprecated.
      Runs the bare test sequence, capturing a screenshot if a test fails
      protected java.lang.String runtimeBrowserString()
      Deprecated.
       
      static boolean seleniumEquals​(java.lang.Object expected, java.lang.Object actual)
      Deprecated.
      Compares two objects, but handles "regexp:" strings like HTML Selenese
      static boolean seleniumEquals​(java.lang.String expected, java.lang.String actual)
      Deprecated.
      Compares two strings, but handles "regexp:" strings like HTML Selenese
      protected void setCaptureScreenShotOnFailure​(boolean b)
      Deprecated.
       
      protected void setTestContext()
      Deprecated.
       
      void setUp()
      Deprecated.
      Calls this.setUp(null)
      void setUp​(java.lang.String url)
      Deprecated.
      Calls this.setUp with the specified url and a default browser.
      void setUp​(java.lang.String url, java.lang.String browserString)
      Deprecated.
      Creates a new DefaultSelenium object and starts it using the specified baseUrl and browser string
      void setUp​(java.lang.String url, java.lang.String browserString, int port)
      Deprecated.
      Creates a new DefaultSelenium object and starts it using the specified baseURL, browser string and port
      void tearDown()
      Deprecated.
      checks for verification errors and stops the browser
      void verifyEquals​(boolean arg1, boolean arg2)
      Deprecated.
      Like assertEquals, but fails at the end of the test (during tearDown)
      void verifyEquals​(java.lang.Object s1, java.lang.Object s2)
      Deprecated.
      Like assertEquals, but fails at the end of the test (during tearDown)
      void verifyEquals​(java.lang.String[] s1, java.lang.String[] s2)
      Deprecated.
      Like assertEquals, but fails at the end of the test (during tearDown)
      void verifyFalse​(boolean b)
      Deprecated.
      Like assertFalse, but fails at the end of the test (during tearDown)
      void verifyNotEquals​(boolean s1, boolean s2)
      Deprecated.
      Like assertNotEquals, but fails at the end of the test (during tearDown)
      void verifyNotEquals​(java.lang.Object s1, java.lang.Object s2)
      Deprecated.
      Like assertNotEquals, but fails at the end of the test (during tearDown)
      void verifyTrue​(boolean b)
      Deprecated.
      Like assertTrue, but fails at the end of the test (during tearDown)
      • Methods inherited from class junit.framework.TestCase

        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, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • selenium

        protected Selenium selenium
        Deprecated.
        Use this object to run all of your selenium tests
    • Constructor Detail

      • SeleneseTestCase

        public SeleneseTestCase()
        Deprecated.
      • SeleneseTestCase

        public SeleneseTestCase​(java.lang.String name)
        Deprecated.
    • Method Detail

      • checkForVerificationErrors

        public void checkForVerificationErrors()
        Deprecated.
        Asserts that there were no verification errors during the current test, failing immediately if any are found
      • clearVerificationErrors

        public void clearVerificationErrors()
        Deprecated.
        Clears out the list of verification errors
      • getText

        public java.lang.String getText()
        Deprecated.
        Returns:
        the body text of the current page
      • pause

        public void pause​(int millisecs)
        Deprecated.
        Sleeps for the specified number of milliseconds
        Parameters:
        millisecs - number of
      • setUp

        public void setUp()
                   throws java.lang.Exception
        Deprecated.
        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
        Deprecated.
        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 - yep, generic Exception
        See Also:
        setUp(String, String)
      • setUp

        public void setUp​(java.lang.String url,
                          java.lang.String browserString)
                   throws java.lang.Exception
        Deprecated.
        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 - yep, generic Exception
      • setUp

        public void setUp​(java.lang.String url,
                          java.lang.String browserString,
                          int port)
        Deprecated.
        Creates a new DefaultSelenium object and starts it using the specified baseURL, browser string and port
        Parameters:
        url - the baseUrl for your tests
        browserString - the browser to use, e.g. *firefox
        port - the port of Selenium RC
      • tearDown

        public void tearDown()
                      throws java.lang.Exception
        Deprecated.
        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)
        Deprecated.
        Like assertEquals, but fails at the end of the test (during tearDown)
        Parameters:
        arg1 - to compare to arg2
        arg2 - to compare to arg1
      • verifyEquals

        public void verifyEquals​(java.lang.Object s1,
                                 java.lang.Object s2)
        Deprecated.
        Like assertEquals, but fails at the end of the test (during tearDown)
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • verifyEquals

        public void verifyEquals​(java.lang.String[] s1,
                                 java.lang.String[] s2)
        Deprecated.
        Like assertEquals, but fails at the end of the test (during tearDown)
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • verifyFalse

        public void verifyFalse​(boolean b)
        Deprecated.
        Like assertFalse, but fails at the end of the test (during tearDown)
        Parameters:
        b - boolean to check is false
      • verifyNotEquals

        public void verifyNotEquals​(boolean s1,
                                    boolean s2)
        Deprecated.
        Like assertNotEquals, but fails at the end of the test (during tearDown)
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • verifyNotEquals

        public void verifyNotEquals​(java.lang.Object s1,
                                    java.lang.Object s2)
        Deprecated.
        Like assertNotEquals, but fails at the end of the test (during tearDown)
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • verifyTrue

        public void verifyTrue​(boolean b)
        Deprecated.
        Like assertTrue, but fails at the end of the test (during tearDown)
        Parameters:
        b - boolean to verify is true
      • assertEquals

        public static void assertEquals​(java.lang.Object s1,
                                        java.lang.Object s2)
        Deprecated.
        Like JUnit's Assert.assertEquals, but knows how to compare string arrays
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • assertEquals

        public static void assertEquals​(java.lang.String s1,
                                        java.lang.String s2)
        Deprecated.
        Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • assertEquals

        public static void assertEquals​(java.lang.String s1,
                                        java.lang.String[] s2)
        Deprecated.
        Like JUnit's Assert.assertEquals, but joins the string array with commas, and handles "regexp:" strings like HTML Selenese
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • assertEquals

        public static void assertEquals​(java.lang.String[] s1,
                                        java.lang.String[] s2)
        Deprecated.
        Asserts that two string arrays have identical string contents
        Parameters:
        s1 - to compare to s2
        s2 - to compare to s1
      • assertNotEquals

        public static void assertNotEquals​(boolean b1,
                                           boolean b2)
        Deprecated.
        Asserts that two booleans are not the same
        Parameters:
        b1 - to compare to b2
        b2 - to compare to b1
      • assertNotEquals

        public static void assertNotEquals​(java.lang.Object obj1,
                                           java.lang.Object obj2)
        Deprecated.
        Asserts that two objects are not the same (compares using .equals())
        Parameters:
        obj1 - to compare to obj2
        obj2 - to compare to obj1
      • seleniumEquals

        public static boolean seleniumEquals​(java.lang.Object expected,
                                             java.lang.Object actual)
        Deprecated.
        Compares two objects, but handles "regexp:" strings like HTML Selenese
        Parameters:
        expected - expression of expected
        actual - expression of actual
        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)
        Deprecated.
        Compares two strings, but handles "regexp:" strings like HTML Selenese
        Parameters:
        expected - expression of expected
        actual - expression of actual
        Returns:
        true if actual matches the expectedPattern, or false otherwise
      • isCaptureScreenShotOnFailure

        protected boolean isCaptureScreenShotOnFailure()
        Deprecated.
      • runtimeBrowserString

        protected java.lang.String runtimeBrowserString()
        Deprecated.
      • setCaptureScreenShotOnFailure

        protected void setCaptureScreenShotOnFailure​(boolean b)
        Deprecated.
      • setTestContext

        protected void setTestContext()
        Deprecated.
      • runBare

        public void runBare()
                     throws java.lang.Throwable
        Deprecated.
        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)
        Deprecated.