Test Abstractions and Fixtures: Standardizing and DRYing Up Test Code


Details
A "test fixture" is a concrete test class that is executed by a test framework's test runner. TestBench takes this concept a step further by allowing for abstract test classes.
Abstract test classes are written using the same lightweight testing API and DSL that TestBench users already know, but unlike test scripts, these are real Ruby classes. They can accept parameters that vary any and all aspects of the test execution.
A test fixture can carry out a generalized testing procedure in any entirely consistent way against any number of objects. This drastically reduces the amount of test code that has to be written and maintained, without having to take any shortcuts or make any undesirable compromises.
This presentation demonstrates an example of leveraging TestBench fixtures to generalize the testing of the often-repeated logic of testing Rails models. It compares fixtures with RSpec's custom matchers and shared examples feature, and addresses RSpec's shortcomings at as a framework for test generalization.
The presentation is led by Join Nathan Ladd, the designer and developer of the TestBench testing framework for Ruby.
The Ruby Study Group meetups are highly-interactive and participatory sessions facilitated by community members that focus more on discovery and learning than on slide decks and presentations.
Space is limited. Please be considerate to your fellow developers and don't reserve a seat with an RSVP if you are only a "maybe". And please release your reservation if you can't make it.
This group conforms to the Eventide Community Protocols. See: https://github.com/eventide-project/contributor-assets/blob/master/protocols/generalized-community-protocols.md

Test Abstractions and Fixtures: Standardizing and DRYing Up Test Code