Class SeleneseTestBase

  • Direct Known Subclasses:
    SeleneseTestNgHelper

    @Deprecated
    public class SeleneseTestBase
    extends java.lang.Object
    Deprecated.
    The RC interface will be removed in Selenium 3.0. Please migrate to using WebDriver.
    Provides a 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
      protected java.lang.StringBuffer verificationErrors
      Deprecated.
       
    • Constructor Summary

      Constructors 
      Constructor Description
      SeleneseTestBase()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static void assertEquals​(java.lang.Object expected, java.lang.Object actual)
      Deprecated.
      Like JUnit's Assert.assertEquals, but knows how to compare string arrays
      static void assertEquals​(java.lang.String[] expected, java.lang.String[] actual)
      Deprecated.
      Asserts that two string arrays have identical string contents
      static void assertEquals​(java.lang.String expected, java.lang.String actual)
      Deprecated.
      Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese
      static void assertEquals​(java.lang.String expected, java.lang.String[] actual)
      Deprecated.
      Like JUnit's Assert.assertEquals, but joins the string array with commas, and handles "regexp:" strings like HTML Selenese
      static void assertFalse​(boolean condition)
      Deprecated.
       
      static void assertFalse​(java.lang.String message, boolean condition)
      Deprecated.
       
      static void assertNotEquals​(boolean expected, boolean actual)
      Deprecated.
      Asserts that two booleans are not the same
      static void assertNotEquals​(java.lang.Object expected, java.lang.Object actual)
      Deprecated.
      Asserts that two objects are not the same (compares using .equals())
      static void assertTrue​(boolean condition)
      Deprecated.
       
      static void assertTrue​(java.lang.String message, boolean condition)
      Deprecated.
       
      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
      static void fail​(java.lang.String message)
      Deprecated.
       
      protected int getDefaultPort()
      Deprecated.
       
      java.lang.String getText()
      Deprecated.
       
      protected boolean isCaptureScreenShotOnFailure()
      Deprecated.
       
      static java.lang.String join​(java.lang.String[] sa, char c)
      Deprecated.
       
      void pause​(int millisecs)
      Deprecated.
      Sleeps for the specified number of milliseconds
      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 expectedPattern, java.lang.String actual)
      Deprecated.
      Compares two strings, but handles "regexp:" strings like HTML Selenese
      protected void setCaptureScreenShotOnFailure​(boolean captureScreenShotOnFailure)
      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 and browser string.
      void tearDown()
      Deprecated.
      checks for verification errors and stops the browser
      void verifyEquals​(boolean expected, boolean actual)
      Deprecated.
      Like assertEquals, but fails at the end of the test (during tearDown)
      void verifyEquals​(java.lang.Object expected, java.lang.Object actual)
      Deprecated.
      Like assertEquals, but fails at the end of the test (during tearDown)
      void verifyEquals​(java.lang.String[] expected, java.lang.String[] actual)
      Deprecated.
      Asserts that two string arrays have identical string contents (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 expected, boolean actual)
      Deprecated.
      Like assertNotEquals, but fails at the end of the test (during tearDown)
      void verifyNotEquals​(java.lang.Object expected, java.lang.Object actual)
      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 java.lang.Object

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

      • selenium

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

        protected java.lang.StringBuffer verificationErrors
        Deprecated.
    • Constructor Detail

      • SeleneseTestBase

        public SeleneseTestBase()
        Deprecated.
    • Method Detail

      • setUp

        public void setUp()
                   throws java.lang.Exception
        Deprecated.
        Calls this.setUp(null)
        Throws:
        java.lang.Exception - because why not
        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 - just in case
        See Also:
        setUp(String, String)
      • runtimeBrowserString

        protected java.lang.String runtimeBrowserString()
        Deprecated.
      • 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. The port is selected as follows: if the server package's RemoteControlConfiguration class is on the classpath, that class' default port is used. Otherwise, if the "server.port" system property is specified, that is used - failing that, the default of 4444 is used.
        Parameters:
        url - the baseUrl for your tests
        browserString - the browser to use, e.g. *firefox
        Throws:
        java.lang.Exception - throws them all!
        See Also:
        setUp(String, String, int)
      • getDefaultPort

        protected int getDefaultPort()
        Deprecated.
      • 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 and browser string. The port is selected as follows: if the server package's RemoteControlConfiguration class is on the classpath, that class' default port is used. Otherwise, if the "server.port" system property is specified, that is used - failing that, the default of 4444 is used.
        Parameters:
        url - the baseUrl for your tests
        browserString - the browser to use, e.g. *firefox
        port - the port that you want to run your tests on
        See Also:
        setUp(String, String, int)
      • 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
      • verifyFalse

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

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

        public void verifyEquals​(java.lang.Object expected,
                                 java.lang.Object actual)
        Deprecated.
        Like assertEquals, but fails at the end of the test (during tearDown)
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • verifyEquals

        public void verifyEquals​(boolean expected,
                                 boolean actual)
        Deprecated.
        Like assertEquals, but fails at the end of the test (during tearDown)
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • assertEquals

        public static void assertEquals​(java.lang.Object expected,
                                        java.lang.Object actual)
        Deprecated.
        Like JUnit's Assert.assertEquals, but knows how to compare string arrays
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • assertEquals

        public static void assertEquals​(java.lang.String expected,
                                        java.lang.String actual)
        Deprecated.
        Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • assertEquals

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

        public static boolean seleniumEquals​(java.lang.String expectedPattern,
                                             java.lang.String actual)
        Deprecated.
        Compares two strings, but handles "regexp:" strings like HTML Selenese
        Parameters:
        expectedPattern - expression of expected
        actual - expression of actual
        Returns:
        true if actual matches the expectedPattern, or false otherwise
      • 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:
        actual - the actual object expected
        expected - object that you want to compare to actual
        Returns:
        true if actual matches the expectedPattern, or false otherwise
        See Also:
        seleniumEquals(String, String)
      • assertEquals

        public static void assertEquals​(java.lang.String[] expected,
                                        java.lang.String[] actual)
        Deprecated.
        Asserts that two string arrays have identical string contents
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • verifyEquals

        public void verifyEquals​(java.lang.String[] expected,
                                 java.lang.String[] actual)
        Deprecated.
        Asserts that two string arrays have identical string contents (fails at the end of the test, during tearDown)
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • join

        public static java.lang.String join​(java.lang.String[] sa,
                                            char c)
        Deprecated.
      • verifyNotEquals

        public void verifyNotEquals​(java.lang.Object expected,
                                    java.lang.Object actual)
        Deprecated.
        Like assertNotEquals, but fails at the end of the test (during tearDown)
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • verifyNotEquals

        public void verifyNotEquals​(boolean expected,
                                    boolean actual)
        Deprecated.
        Like assertNotEquals, but fails at the end of the test (during tearDown)
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • assertNotEquals

        public static void assertNotEquals​(java.lang.Object expected,
                                           java.lang.Object actual)
        Deprecated.
        Asserts that two objects are not the same (compares using .equals())
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • fail

        public static void fail​(java.lang.String message)
        Deprecated.
      • assertTrue

        public static void assertTrue​(java.lang.String message,
                                      boolean condition)
        Deprecated.
      • assertTrue

        public static void assertTrue​(boolean condition)
        Deprecated.
      • assertFalse

        public static void assertFalse​(java.lang.String message,
                                       boolean condition)
        Deprecated.
      • assertFalse

        public static void assertFalse​(boolean condition)
        Deprecated.
      • assertNotEquals

        public static void assertNotEquals​(boolean expected,
                                           boolean actual)
        Deprecated.
        Asserts that two booleans are not the same
        Parameters:
        actual - the actual object expected
        expected - object that you want to compare to actual
      • pause

        public void pause​(int millisecs)
        Deprecated.
        Sleeps for the specified number of milliseconds
        Parameters:
        millisecs - number of
      • 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
      • tearDown

        public void tearDown()
                      throws java.lang.Exception
        Deprecated.
        checks for verification errors and stops the browser
        Throws:
        java.lang.Exception - actually, just AssertionError, but someone was lazy?
      • isCaptureScreenShotOnFailure

        protected boolean isCaptureScreenShotOnFailure()
        Deprecated.
      • setCaptureScreenShotOnFailure

        protected void setCaptureScreenShotOnFailure​(boolean captureScreenShotOnFailure)
        Deprecated.