I have watched a video on youtube that suggest using screenplay pattern as an alternative to using the usual pageobjects. The only advantage I see is that the page object classes are not as big. Is there something else I am missing ? I have been searching and all website are always referencing the example on the the youtube lecture using serenity bdd. Can someone explain why else is it better (or maybe worse) than using page objects?
An example that does not use serenity bdd would be really help.
In a nutshell, ScreenPlay encourages better software engineering practices, and thus makes the tests faster to write and easier to maintain in the long term, but requires a better understanding of OOP to yield its full benefits (though it does scale remarkably well with junior engineers as long as there are a couple of senior engineers around who understand the pattern).
Page Objects where only ever intended as a stepping stone to help introduce automated testers to better test automation practices, but it can still lead to hard-to-maintain code. Take a look at this article for the origin story: https://ideas.riverglide.com/page-objects-refactored-12ec3541990.
There are a couple of other implementations of Screenplay, including: - JNarrate: https://bitbucket.org/testingreflections/jnarrate/wiki/Examples - Narrative: https://github.com/tim-group/narrative
ScreenPlay is an actor or user-centric model, which is easier to scale and more reusable than step libraries in many cases. Once a task is written, you rarely have to change it (respecting the Open-Closed Principle). An actor-centric model also makes it easier to model situations where several users interact in a scenario (for example, with different browsers). Jan Molak talks about the actor-centric side of Screenplay in this article: https://janmolak.com/user-centred-design-how-a-50-year-old-technique-became-the-key-to-scalable-test-automation-66a658a36555
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With