Code Monkey home page Code Monkey logo

automation-design-patterns's Introduction

automation-design-patterns

Use the power of design patterns to solve different software automation related problems - Python

List of design patterns covered for automation testing

Page object pattern

Summary

  • Hide bad APIs behind better ones
  • Automation related: represent each page (including elements and action over them) of an application as an object

Example

  • Targeted app: https://www.youtube.com
  • Implement base page:
    • Currently supported:
      • open/quit the browser
      • wait for elements to be visible
    • Feature methods:
      • generic validator
      • different clicks
  • Each new page created will extend the base class
  • Implement a search for a video as example:
    • enter a string to query e.g. Python
    • click on search button
    • filter result list based on a keyword e.g. Python
    • select the video found based on this query
  • In tests section, under page_object_pattern package, two tests are performed:
    • a simple one to perform the wait for element action from base class
    • a search flow
    • note that from now on the test implementation is hidden in a specific page;
    • to perform some tests, you just have to call different page specific methods

Singleton

###Summery

  • Creational design pattern.
  • Provides an easy way to create a single instance of an object.

###Example

  • Access the same instance of the driver session class.
  1. The entire definition of the object class is encapsulated in the builder class:

    • The outer class exposes a method that returns the instance of the inner class.
  2. Design a class that handles the instantiation.

    • Inject the definition of the desired class in the singleton factory and the factory is responsible for returning the same instance.

Factory pattern

Simple factory

Abstract factory

Authors

  • Paul Bodean
  • Eugen Meltis

License

This project is licensed under the MIT License - see the LICENSE file for details

automation-design-patterns's People

Contributors

paulbodean88 avatar meltiseugen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.