|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.eclipse.swtbot.swt.finder.SWTBotTestCase
public abstract class SWTBotTestCase
The SWTBotTestCase extends the JUnit TestCase to provide extra capabilities for comparing widgets and other UI items.
SWTBotAssert| Field Summary | |
|---|---|
protected SWTBot |
bot
An instance of SWTBot that may be used by extending items. |
| Constructor Summary | |
|---|---|
SWTBotTestCase()
|
|
| Method Summary | |
|---|---|
static void |
assertContains(String needle,
String hayStack)
Asserts that the needle is contained within the hayStack. |
static void |
assertDoesNotContain(String needle,
String hayStack)
Asserts that the needle is not present in the hayStack. |
static void |
assertEnabled(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is enabled. |
static void |
assertMatchesRegex(String regex,
AbstractSWTBot<? extends Widget> actual)
Assert that the widget text matches the regex. |
static void |
assertMatchesRegex(String regex,
String actual)
Assert that the widget text matches the regex. |
static void |
assertMatchesRegex(String regex,
Widget actual)
Assert that the widget text matches the regex. |
static void |
assertNotEnabled(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is not enabled. |
static void |
assertNotSameWidget(String message,
Widget expected,
Widget actual)
Asserts the two widgets do not refer to the same object. |
static void |
assertNotSameWidget(Widget expected,
Widget actual)
Asserts that two widgets do not refer to the same object. |
static void |
assertNotVisible(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is not visible. |
static void |
assertSameWidget(String message,
Widget expected,
Widget actual)
Asserts that two widgets refer to the same widgets. |
static void |
assertSameWidget(Widget expected,
Widget actual)
Asserts that two widgets refer to the same widget. |
static void |
assertText(String expected,
AbstractSWTBot<? extends Widget> widget)
Assert that the given string is the same as the widgets text. |
static void |
assertText(String expected,
Widget widget)
Assert that the given string is the same as the widgets text. |
static void |
assertTextContains(String expected,
AbstractSWTBot<? extends Widget> widget)
Assert that the text on the widget contains the expected text. |
static void |
assertTextContains(String expected,
Widget widget)
Assert that the text on the widget contains the expected text. |
static void |
assertTextDoesNotContain(String expected,
AbstractSWTBot<? extends Widget> widget)
Assert that the text on the widget does not contain the expected text. |
static void |
assertTextDoesNotContain(String expected,
Widget widget)
Assert that the text on the widget does not contain the expected text. |
static void |
assertVisible(AbstractSWTBot<? extends Widget> widget)
Asserts that the widget is visible. |
static boolean |
captureScreenshot(String fileName)
Allows the screen shot to be captured and saved to the given file. |
static void |
pass()
A helper to explicitly convey that the test has passed. |
void |
runBare()
Overides the runBare method to TestCase to add the ability to capture a screen shot when an error is thrown. |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, 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, 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 |
|---|
protected SWTBot bot
| Constructor Detail |
|---|
public SWTBotTestCase()
| Method Detail |
|---|
public static void assertNotSameWidget(Widget expected,
Widget actual)
expected - the object you don't expectactual - the object to compare to unexpectedAssert.assertNotSame(String, Object, Object)
public static void assertNotSameWidget(String message,
Widget expected,
Widget actual)
message - the identifying message or null for the AssertionErrorexpected - the object you don't expectactual - the object to compare to unexpected
public static void assertContains(String needle,
String hayStack)
needle is contained within the hayStack.
needle - the text to search in the hayStack.hayStack - the text to look within.
public static void assertDoesNotContain(String needle,
String hayStack)
needle is not present in the hayStack.
needle - the text to search in the hayStack.hayStack - the text to look within.
public static void assertSameWidget(Widget expected,
Widget actual)
expected - the expected widgetactual - the widget to compare to expected
public static void assertSameWidget(String message,
Widget expected,
Widget actual)
message - the identifying message or null for the AssertionErrorexpected - the expected widgetactual - the widget to compare to expectedpublic static void pass()
public static void assertText(String expected,
Widget widget)
expected - the expected textwidget - the widget to get the text from to compare.
public static void assertText(String expected,
AbstractSWTBot<? extends Widget> widget)
expected - the expected textwidget - the widget to get the text from to compare.
public static void assertTextContains(String expected,
Widget widget)
expected - the expected text.widget - the widget
public static void assertTextContains(String expected,
AbstractSWTBot<? extends Widget> widget)
expected - the expected textwidget - the widget
public static void assertTextDoesNotContain(String expected,
Widget widget)
expected - the expected textwidget - the widget
public static void assertTextDoesNotContain(String expected,
AbstractSWTBot<? extends Widget> widget)
expected - the expected textwidget - the widgetpublic static void assertEnabled(AbstractSWTBot<? extends Widget> widget)
widget - the widget.public static void assertNotEnabled(AbstractSWTBot<? extends Widget> widget)
widget - the widget.public static void assertVisible(AbstractSWTBot<? extends Widget> widget)
widget - the widget.public static void assertNotVisible(AbstractSWTBot<? extends Widget> widget)
widget - the widget.
public void runBare()
throws Throwable
screenshots that gets
created if it does not already exist. The screenshot will be saved with the file screenshots/screenshot-<classname>.<testname>.png
runBare in class junit.framework.TestCaseThrowable - Thrown if an error occurs during running.TestCase.runBare()public static boolean captureScreenshot(String fileName)
fileName - the filename to save screenshot to.
true if the screenshot was created and saved, false otherwise.SWTUtils.captureScreenshot(String)
public static void assertMatchesRegex(String regex,
AbstractSWTBot<? extends Widget> actual)
regex - the regex.actual - the widget.
public static void assertMatchesRegex(String regex,
Widget actual)
regex - the regex.actual - the widget.
public static void assertMatchesRegex(String regex,
String actual)
regex - the regex.actual - the widget.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||