Package com.diffplug.common.swt
Class InteractiveTest
java.lang.Object
com.diffplug.common.swt.InteractiveTest
InteractiveTest opens a
Coat
or Shell
, and displays instructions
for a human tester to determine whether the test passed or failed. This makes
it extremely easy to create and specify a UI test, which can be converted into
an automated UI test at a later date.
If the system property `com.diffplug.InteractiveTest.autoclose.milliseconds` is set, then the tests will open and then automatically pass after the specified timeout. This lets a headless CI server ensure that the tests are in working order, although a meatbag is still required for full validation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Marker class for interactive tests that aren't compatible with auto-close. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Key for specifying that autoclose should be used.static final int
Default width of testCoat().static final int
Default height of testCoat(). -
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeAndFail
(Control ctl, Throwable e) Closes the test for the given control, and fails.static void
closeAndPass
(Control ctl) Closes the test for the given control, and passes.static void
static void
static void
static void
static void
testShellWithoutHandle
(String instructions, Consumer<Display> harness) Same as testShell, but for situations where it is impossible to return the shell handle.
-
Field Details
-
AUTOCLOSE_KEY
Key for specifying that autoclose should be used.- See Also:
-
DEFAULT_COLS
public static final int DEFAULT_COLSDefault width of testCoat().- See Also:
-
DEFAULT_ROWS
public static final int DEFAULT_ROWSDefault height of testCoat().- See Also:
-
-
Method Details
-
testCoat
- Parameters:
instructions
- Instructions for the user to follow.coat
- A function to populate the test composite.
-
testCoat
public static void testCoat(String instructions, int cols, int rows, com.diffplug.common.swt.Coat coat) - Parameters:
instructions
- Instructions for the user to follow.cols
- Width of the test composite (in multiples of the system font height).rows
- Height of the test composite (in multiples of the system font height).coat
- A function to populate the test composite.
-
testCoat
public static void testCoat(String instructions, @Nullable Point size, com.diffplug.common.swt.Coat coat) - Parameters:
instructions
- Instructions for the user to follow.size
- Width and height of the test composite (in multiples of the system font height).coat
- A function to populate the test composite.
-
testShell
- Parameters:
instructions
- Instructions for the user to follow.harness
- A function which takes a Display and returns a Shell to test.
-
closeAndPass
Closes the test for the given control, and passes. -
closeAndFail
Closes the test for the given control, and fails. -
testShellWithoutHandle
Same as testShell, but for situations where it is impossible to return the shell handle.- Parameters:
instructions
- Instructions for the user to follow.harness
- A function which takes a Display and returns a Shell to test. The instructions will pop-up next to the test shell.
-