Addition by Abstraction: A conversation about abstraction and dynamic coding.

Test automation traditionally can be a very brittle and in turn expensive to maintain way for software to be tested. My presentation provides insight on how to improve the dynamic nature of a test framework to make automation resilient to change.


Outline/Structure of the Talk


Orthogonality- Code functionalities touch at one point

Page Object: One Point of interaction between the Watir functionality and the step definition calling the functionality.

Metaprogramming- Taking details of code

YAML Files: Lack of hard coding of input data multiple references to the same data object in YAML, Embedded Ruby- Faker Gem, randomizing test data.

Step Definitions: Step definitions take details out of the code by allowing the gherkin to be expressive. Step definitions should be written in the most dynamic way so the most functionality should be attained from the step processes. Similar steps should be combined whenever possible.

Gherkin: Nested Steps

The Law of Demeter- decoupling

Helpers: There should be a layer of abstraction that protects your step definitions from any external source in which your code accesses. This allows for quick and efficient change when necessary that will automatically update your whole test suite.

Refactoring: Everyone makes mistakes, there is always a more efficient way to do something. How to refactor towards abstraction.

Dynamic Failures: Test your code to fail as early as possible (RSPEC) once a failure occurs have code to ensure that steps are completed to roll back any changes made to your environment.

Learning Outcome


An overview of common dynamic coding ideologies including Metaprogramming, The Law of Demeter, Error Handling, Orthogonality and Decoupling. The goal of this presentation is to help others create a test framework that is: 1) Dynamic 2) Expandable 3) reusable 4) maintainable 5) abstract.

An overview of how we can make a code base adaptable and well-designed. Each of these core concepts is then split into tools/concepts we can utilize to reach this goal. For Adaptability we discuss: Orthogonality-the process of limiting interaction between code, DRY-the concept of not duplicating logic, Metaprogramming-separating logic from details and Refactoring-optimization of code structure. For making code well-designed we discuss: TDD-Test Driven Development is the process of writing code through testing, Code Coverage-tracking the amount of your code base that is unit tested, Dynamic Failures-ensuring your code fails in a way that is meaningful to the end user, Data Setup and Cleanup-ensuring that your test suite can create and destroy its own data.

Target Audience

Developers, Automation Developers

Prerequisites for Attendees


schedule Submitted 2 years ago