Course Review

Creating Maintainable Contexts for Automated Testing – Course Review

I have just finished Creating Maintainable Contexts for Automated Testing by Mel Grubb, on Pluralsight (yes, that title is quite a mouthful!)

I haven't really bothered with reviews of most courses I take – counting this one I watched 43 this year – a bunch on Pluralsight, some MBA courses, and 14 non-fiction books. This one was interesting enough that it was worth mentioning.

It covers ways to make your test code cleaner. What I liked:

  • using a Random library to document what is boilerplate on a test is what is important – name = library.RandomName() is very different from name = “Luiz Marques”, as it shows that it has no particular importance.
  • From the next step, adding Mother objects, which are simple static classes that return ready to go instances – such as .Simple() and .Typical(). If you need to, you can then change anything that is important for the test, and it will be very obvious. As a bonus, any changes to the objects (such as an added property) can be dealt on a single place, instead of having to be fixed on possibly dozens of tests.
  • Converting the mothers to the Builder pattern, which makes thing slightly clearer (but adds a lot of code), improving discoverability and makes it easier to change objects.
  • Using CSX to auto-generate most of the builder objects on each build.

Overall, very interesting, and well worth the time, specially if you already have Pluralsight.

By Luiz A D R Marques

I've been developing software and selling it on-line since 1994. Current products include STG FolderPrint Plus - a tool to Print Folders, and STGThumb - HTML Album Generator, among others. Some of my other sites - Disk Usage, Directory Printer ,Print Folders and Jejum Intermitente .