Copy

Property Testing a Permutation Generator

Hey <<First Name>>,

Happy Thanksgiving!

This past week I spent some time testing the permutation generator we wrote last time using property-based testing. Permutations have some easily understandable and well-defined properties that lend themselves well to property testing.

If you’re interested in property testing, definitely check out the full article.

I had an interesting thought while I was writing these tests. The last two properties that I tested are best summarized as “the generator only includes items from the list”, and “it uses the correct number of duplicated items”. I realized that these two properties could be more succinctly expressed as “the generator uses each element in the list exactly once.”

Is it better to be more explicit and verbose with my tests, or is better to embrace these generalizations in our set of properties? Being verbose (and redundant) in our testing might help us poor humans understand what our tests are doing. But reducing the number of properties needed to completely express our system might give us deeper insights into the system under test.

I’m leaning towards the latter, and decided to reduce both properties into the single, more generalized property.

How was your week? If you celebrate Thanksgiving, how was it?

Pete
Copyright © 2018 East5th, All rights reserved.

Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list