Package org.inspirenxe.strata.testing
package org.inspirenxe.strata.testing
A test kit for applications: open a
Screen without an engine or a
display, find its components, drive it with simulated input and check what it shows.
try (ScreenTester tester = ScreenTester.open(new ShopScreen(shop))) {
tester.click(tester.byId("quantity", TextBox.class)).type("3")
.click(tester.find(Button.class, Matching.text("Buy")));
assertEquals("29.97", tester.byId("total", Label.class).text().plain());
}
The kit ships in the test fixtures of strata-core; a Gradle build adds it with
testImplementation(testFixtures("org.inspirenxe:strata-core:<version>")). Its API uses the types of
strata-api and strata-spi only, and it brings core at run time. Tests that compare pixels need a
real renderer, such as Strata-Swing's snapshots.
-
ClassDescriptionCommon conditions for
ScreenTester.find(Class, Predicate)andScreenTester.findAll(Class, Predicate).Opens aScreenfor a test, without an engine or a display, and drives it as a person would.How aScreenTestershows its screen.