public class InteractiveTest extends Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
InteractiveTest.FailsWithoutUser
Marker class for interactive tests that aren't compatible with auto-close.
|
Modifier and Type | Field and Description |
---|---|
static String |
AUTOCLOSE_KEY
Key for specifying that autoclose should be used.
|
static int |
DEFAULT_COLS
Default width of testCoat().
|
static int |
DEFAULT_ROWS
Default height of testCoat().
|
Modifier and Type | Method and Description |
---|---|
static 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 |
testCoat(String instructions,
Coat coat) |
static void |
testCoat(String instructions,
int cols,
int rows,
Coat coat) |
static void |
testCoat(String instructions,
Point size,
Coat coat) |
static void |
testShell(String instructions,
Function<Display,Shell> harness) |
static void |
testShellWithoutHandle(String instructions,
Consumer<Display> harness)
Same as testShell, but for situations where it is impossible to return the shell handle.
|
public static final String AUTOCLOSE_KEY
public static final int DEFAULT_COLS
public static final int DEFAULT_ROWS
public static void testCoat(String instructions, Coat coat)
instructions
- Instructions for the user to follow.coat
- A function to populate the test composite.public static void testCoat(String instructions, int cols, int rows, Coat coat)
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.public static void testCoat(String instructions, @Nullable Point size, Coat coat)
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.public static void testShell(String instructions, Function<Display,Shell> harness)
instructions
- Instructions for the user to follow.harness
- A function which takes a Display and returns a Shell to test.public static void closeAndPass(Control ctl)
public static void closeAndFail(Control ctl, Throwable e)
public static void testShellWithoutHandle(String instructions, Consumer<Display> harness)
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.