Package com.diffplug.common.swt
Class InteractiveTest
- java.lang.Object
-
- com.diffplug.common.swt.InteractiveTest
-
public class InteractiveTest extends java.lang.Object
InteractiveTest opens aCoat
orShell
, 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 Classes Modifier and Type Class Description static class
InteractiveTest.FailsWithoutUser
Marker class for interactive tests that aren't compatible with auto-close.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.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().
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
closeAndFail(Control ctl, java.lang.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(java.lang.String instructions, int cols, int rows, com.diffplug.common.swt.Coat coat)
static void
testCoat(java.lang.String instructions, com.diffplug.common.swt.Coat coat)
static void
testCoat(java.lang.String instructions, Point size, com.diffplug.common.swt.Coat coat)
static void
testShell(java.lang.String instructions, java.util.function.Function<Display,Shell> harness)
static void
testShellWithoutHandle(java.lang.String instructions, java.util.function.Consumer<Display> harness)
Same as testShell, but for situations where it is impossible to return the shell handle.
-
-
-
Field Detail
-
AUTOCLOSE_KEY
public static final java.lang.String AUTOCLOSE_KEY
Key for specifying that autoclose should be used.- See Also:
- Constant Field Values
-
DEFAULT_COLS
public static final int DEFAULT_COLS
Default width of testCoat().- See Also:
- Constant Field Values
-
DEFAULT_ROWS
public static final int DEFAULT_ROWS
Default height of testCoat().- See Also:
- Constant Field Values
-
-
Method Detail
-
testCoat
public static void testCoat(java.lang.String instructions, com.diffplug.common.swt.Coat coat)
- Parameters:
instructions
- Instructions for the user to follow.coat
- A function to populate the test composite.
-
testCoat
public static void testCoat(java.lang.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(java.lang.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
public static void testShell(java.lang.String instructions, java.util.function.Function<Display,Shell> harness)
- Parameters:
instructions
- Instructions for the user to follow.harness
- A function which takes a Display and returns a Shell to test.
-
closeAndPass
public static void closeAndPass(Control ctl)
Closes the test for the given control, and passes.
-
closeAndFail
public static void closeAndFail(Control ctl, java.lang.Throwable e)
Closes the test for the given control, and fails.
-
testShellWithoutHandle
public static void testShellWithoutHandle(java.lang.String instructions, java.util.function.Consumer<Display> harness)
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.
-
-