Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • In a former job I saw a system where every object was given a method to instantiate itself from a YAML data file. And by "instantiate itself" I include "Go and insert itself in the test database you are using." (You want your stored procedures and views properly tested, right?) And (this is important important), every field not specified in the YAML was automatically given a sensible default.

    Then in the test files they set up a nested YAML data structure that was automatically turned into a slew of related objects that they could then test with. (If a property of one object was another, that would show up as a nested data structure, and the related objects would be created with appropriately connecting IDs.) When they were done the tests, they tore down all of the objects.

    And now for the fun part. Suppose you needed to add a field to the object. All you did was add the field, made the "auto-create from YAML" method supply an appropriate default, and added some more data and tests. All of your previous tests would Just Work.

    I was quite impressed and suggested to the guy who wrote the system that he should write an article about it. But he never did, and this is all proprietary code. (Which was on a project that later got abandoned.)