Design patterns in testing
Before starting this article Im going to give you the standard definition for design pattern:
In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. Adesign pattern isn’t a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.
In Testing people talk a lot about design patterns and page object model or POM, so Page Object Model is an Object Repository designpattern in Selenium WebDriver. POM creates our testing code maintainable, reusable. Page Factory is an optimised way to create object repository in POM concept.
So I would like to share with you guys a repository from @notimewaste on git hub and I tend to agree with him when coms about patterns.
First : Antipatterns
Remember your first project in selenium or when you just started to practice how it looked like ? I like to call it “line”… I know sounds weird but just looks at this following pice of code :
For me looks like a line if you brake it , the from doesn’t know any clue about the tail and your program stops there :).
Data-driven testing is the creation of test scripts to run together with their related data sets in a Framework. The framework provides re-usable test logic to reduce maintenance and improve test coverage. Input and result (test criteria) data values can be stored in one or more central data sources or databases, the actual format and organisation can be implementation specific.
The data comprises variables used for both input values and output verification values. In advanced (mature) automation environments data can be harvested from a running system using a purpose-built custom tool or sniffer, the DDT framework thus performs playback of harvested data producing a powerful automated regression testing tool.
Navigation through the program, reading of the data sources, and logging of test status and information are all coded in the test script.
You can check the data driven example on notimewaist’s git hub page.
You can have a look at the previous articles when we discussed about page object model in Java , C# with specflow and Ruby watir.
For me the one that worked really well was Page object model combined with a data driven and keyword framework. it’s kind of a “all in one solution” framework but the key of success in this is to have really good reporting tool and improve your tests based on your stats. I love stats and I can say I managed to get the framework to have less than 0.5% flaky tests just by listening to the stats and improving the tests and the performance of the framework.
Conclusions : Try to figure out which design patten works better for you and make the best out of it.
The post Design patterns in testing appeared first on TestingRepository.