With the screenplay pattern it is possible to use the same test steps with different implementations (controlled by abilities) to test different UIs. Especially with spring you can run e2e tests against the service layer directly, against the web layer or against the browser.
This example is one way of leveraging actors and abilities.
I've implemented the websocket and browser side of things.
BrowserIT
WebsocketIT
both use the steps defined in the ChatScenarios so you got a single file where you can describe intended behavior. Looks a little un-DRY but this way you can create a single report for both UIs and mark specific tests as pending or ignored or don't implement them at all. The alternative might be a UI parameter and using Assume
to decide if a test should run. See BotcHappyPathIT.kt for an example how this could look like.
Is it fancy? I guess.
Is it easy? I guess not so much.
Is it useful? Maybe? Why start automated tests against a browser when you are not sure that the backend is behaving as intended. And when you have more UIs (like REST, CLI...) you can with a single step description ensure the same behavior over all UIs.
-
Java - 1.8.x
-
Maven - 3.x.x
-
Chrome
mvn clean verify