/** Like JUnit's Assert.assertEquals, but joins the string array with commas, and * handles "regexp:" strings like HTML Selenese */ public static void assertEquals(String s1, String[] s2) { SeleneseTestBase.assertEquals(s1, s2); }
/** Like JUnit's Assert.assertEquals, but handles "regexp:" strings like HTML Selenese */ public static void assertEquals(String s1, String s2) { assertTrue("Expected \"" + s1 + "\" but saw \"" + s2 + "\" instead", seleniumEquals(s1, s2)); }
/** Asserts that there were no verification errors during the current test, failing immediately if any are found */ public void checkForVerificationErrors() { stb.checkForVerificationErrors(); }
/** Like JUnit's Assert.assertEquals, but joins the string array with commas, and * handles "regexp:" strings like HTML Selenese */ public static void assertEquals(String s1, String[] s2) { assertEquals(s1, join(s2, ',')); }
/** * Calls this.setUp with the specified url and a default browser. On Windows, the default browser is *iexplore; otherwise, the default browser is *firefox. * @see #setUp(String, String) * @param url the baseUrl to use for your Selenium tests * @throws Exception * */ public void setUp(String url) throws Exception { setUp(url, runtimeBrowserString()); }
/** * Creates a new DefaultSelenium object and starts it using the specified baseUrl and browser string * @param url the baseUrl for your tests * @param browserString the browser to use, e.g. *firefox * @throws Exception */ public void setUp(String url, String browserString) throws Exception { stb.setUp(url, browserString); selenium = stb.selenium; }
/** Compares two strings, but handles "regexp:" strings like HTML Selenese * * @param expectedPattern * @param actual * @return true if actual matches the expectedPattern, or false otherwise */ public static boolean seleniumEquals(String expected, String actual) { return SeleneseTestBase.seleniumEquals(expected, actual); }
@Override public void verifyEquals(String[] actual, String[] expected) { super.verifyEquals(expected, actual); } }
/** Like assertEquals, but fails at the end of the test (during tearDown) */ public void verifyEquals(Object s1, Object s2) { try { assertEquals(s1, s2); } catch (Error e) { verificationErrors.append(throwableToString(e)); } }
private static String verifyEqualsAndReturnComparisonDumpIfNot(String[] s1, String[] s2) { boolean misMatch = false; if (s1.length != s2.length) { misMatch = true; } for (int j = 0; j < s1.length; j++) { if (!seleniumEquals(s1[j], s2[j])) { misMatch = true; break; } } if (misMatch) { return "Expected " + stringArrayToString(s1) + " but saw " + stringArrayToString(s2); } return null; }
/** * 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. * * @see #setUp(String, String, int) * @param url the baseUrl for your tests * @param browserString the browser to use, e.g. *firefox * @throws Exception */ public void setUp(String url, String browserString) throws Exception { setUp(url, browserString, getDefaultPort()); }
/** Like assertTrue, but fails at the end of the test (during tearDown) */ public void verifyTrue(boolean b) { try { assertTrue(b); } catch (Error e) { verificationErrors.append(throwableToString(e)); } }
static public void assertTrue(boolean condition) { assertTrue(null, condition); }
/** Asserts that there were no verification errors during the current test, failing immediately if any are found */ public void checkForVerificationErrors() { String verificationErrorString = verificationErrors.toString(); clearVerificationErrors(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } }
static public void assertTrue(String message, boolean condition) { if (!condition) fail(message); }
/** checks for verification errors and stops the browser */ public void tearDown() throws Exception { stb.tearDown(); }
/** Like assertNotEquals, but fails at the end of the test (during tearDown) */ public void verifyNotEquals(Object s1, Object s2) { try { assertNotEquals(s1, s2); } catch (AssertionFailedError e) { verificationErrors.append(throwableToString(e)); } }
/** Like assertFalse, but fails at the end of the test (during tearDown) */ public void verifyFalse(boolean b) { try { assertFalse(b); } catch (Error e) { verificationErrors.append(throwableToString(e)); } }
/** Asserts that two objects are not the same (compares using .equals()) */ public static void assertNotEquals(Object obj1, Object obj2) { SeleneseTestBase.assertNotEquals(obj1, obj2); }
/** Calls this.setUp(null) * @see #setUp(String) */ public void setUp() throws Exception { stb.setUp(); selenium = stb.selenium; }