Package com.thoughtworks.selenium
Class SeleneseTestNgHelper
- java.lang.Object
-
- com.thoughtworks.selenium.SeleneseTestBase
-
- com.thoughtworks.selenium.SeleneseTestNgHelper
-
public class SeleneseTestNgHelper extends SeleneseTestBase
-
-
Field Summary
-
Fields inherited from class com.thoughtworks.selenium.SeleneseTestBase
selenium, verificationErrors
-
-
Constructor Summary
Constructors Constructor Description SeleneseTestNgHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
assertEquals(java.lang.Object actual, java.lang.Object expected)
static void
assertEquals(java.lang.String[] actual, java.lang.String[] expected)
static void
assertEquals(java.lang.String actual, java.lang.String expected)
static void
assertEquals(java.lang.String actual, java.lang.String[] expected)
void
attachScreenshotListener(java.lang.String host, java.lang.String port, org.testng.ITestContext context)
void
checkForVerificationErrors()
Asserts that there were no verification errors during the current test, failing immediately if any are foundvoid
getSelenium(boolean restartSession)
void
selectDefaultWindow()
static boolean
seleniumEquals(java.lang.Object actual, java.lang.Object expected)
static boolean
seleniumEquals(java.lang.String actual, java.lang.String expected)
void
setTestContext(java.lang.reflect.Method method)
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 browservoid
verifyEquals(java.lang.Object actual, java.lang.Object expected)
Like assertEquals, but fails at the end of the test (during tearDown)void
verifyEquals(java.lang.String[] actual, java.lang.String[] expected)
Asserts that two string arrays have identical string contents (fails at the end of the test, during tearDown)-
Methods inherited from class com.thoughtworks.selenium.SeleneseTestBase
assertFalse, assertFalse, assertNotEquals, assertNotEquals, assertTrue, assertTrue, clearVerificationErrors, fail, getDefaultPort, getText, isCaptureScreenShotOnFailure, join, pause, runtimeBrowserString, setCaptureScreenShotOnFailure, setUp, setUp, setUp, verifyEquals, verifyFalse, verifyNotEquals, verifyNotEquals, verifyTrue
-
-
-
-
Method Detail
-
setUp
@BeforeTest public void setUp(java.lang.String url, java.lang.String browserString) throws java.lang.Exception
Description copied from class:SeleneseTestBase
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.- Overrides:
setUp
in classSeleneseTestBase
- Parameters:
url
- the baseUrl for your testsbrowserString
- the browser to use, e.g. *firefox- Throws:
java.lang.Exception
- throws them all!- See Also:
SeleneseTestBase.setUp(String, String, int)
-
getSelenium
@BeforeClass public void getSelenium(boolean restartSession)
-
setTestContext
@BeforeMethod public void setTestContext(java.lang.reflect.Method method)
-
attachScreenshotListener
@BeforeSuite public void attachScreenshotListener(java.lang.String host, java.lang.String port, org.testng.ITestContext context)
-
checkForVerificationErrors
@AfterMethod public void checkForVerificationErrors()
Description copied from class:SeleneseTestBase
Asserts that there were no verification errors during the current test, failing immediately if any are found- Overrides:
checkForVerificationErrors
in classSeleneseTestBase
-
selectDefaultWindow
@AfterMethod(alwaysRun=true) public void selectDefaultWindow()
-
tearDown
@AfterTest(alwaysRun=true) public void tearDown() throws java.lang.Exception
Description copied from class:SeleneseTestBase
checks for verification errors and stops the browser- Overrides:
tearDown
in classSeleneseTestBase
- Throws:
java.lang.Exception
- actually, just AssertionError, but someone was lazy?
-
assertEquals
public static void assertEquals(java.lang.Object actual, java.lang.Object expected)
-
assertEquals
public static void assertEquals(java.lang.String actual, java.lang.String expected)
-
assertEquals
public static void assertEquals(java.lang.String actual, java.lang.String[] expected)
-
assertEquals
public static void assertEquals(java.lang.String[] actual, java.lang.String[] expected)
-
seleniumEquals
public static boolean seleniumEquals(java.lang.Object actual, java.lang.Object expected)
-
seleniumEquals
public static boolean seleniumEquals(java.lang.String actual, java.lang.String expected)
-
verifyEquals
public void verifyEquals(java.lang.Object actual, java.lang.Object expected)
Description copied from class:SeleneseTestBase
Like assertEquals, but fails at the end of the test (during tearDown)- Overrides:
verifyEquals
in classSeleneseTestBase
- Parameters:
actual
- object that you want to compare to actualexpected
- the actual object expected
-
verifyEquals
public void verifyEquals(java.lang.String[] actual, java.lang.String[] expected)
Description copied from class:SeleneseTestBase
Asserts that two string arrays have identical string contents (fails at the end of the test, during tearDown)- Overrides:
verifyEquals
in classSeleneseTestBase
- Parameters:
actual
- object that you want to compare to actualexpected
- the actual object expected
-
-