This project is a simple demonstration showing the difference between the PageObject and the Screenplay pattern, both implemented using the Serenity BDD library and JUnit.
The web tests you'll find here run against the https://todomvc.com/examples/angular/dist/browser/#/all application and are organised
by feature in packages under src/test/java/net/serenitybdd/demos/todos/<pattern name>/features
.
By default the tests run on Chrome, so make sure you have the latest chromedriver instance on your system path.
These tests use pages and steps defined in src/main/java/net/serenitybdd/demos/todos/pageobjects
.
The overall project structure is shown below:
+ model
Domain model classes
+ pages
PageObjects
+ steps
Tasks and assertions performed by the "user"
These tests use tasks, actions, questions and page elements defined in src/main/java/net/serenitybdd/demos/todos/screenplay
.
The overall project structure is shown below:
+ model
Domain model classes
+ tasks
Business-level tasks
+ action
UI interactions
+ pages
Page Objects and Page Elements
+ questions
Objects used to query the application
To run the project you'll need JDK 1.8 and Maven installed.
The first demo shows the integration of Serenity BDD, Screenplay and Cucumber JVM. To run it, execute:
mvn clean verify -Pcucumber
The second demo covers the integration of Serenity BDD, Screenplay and JUnit.
To run it, execute:
mvn clean verify -Pscreenplay
We've also included a demo of how the tests you've just seen implemented using the Screenplay Pattern would have looked if they were implemented using the Page Objects.
To run it, execute:
mvn clean verify -Ppageobjects
The Serenity reports will be generated in the target/site/serenity
directory.