🔗 Approval Tests

Approval Tests - Home Unit testing asserts can be difficult to use. Approval tests simplify this by taking a snapshot of the results, and confirming that they have not changed. Interesting approach to testing using Combination Approvals: @Test public void upateQuality() throws Exception { CombinationApprovals.verifyAllCombinations( this::doUpdateQuality, new String []{"foo", "bar", "baz"}, new Integer []{-1, 0, 11}, new Integer[0, 1, 49, 50}); } private String doUpdateQuality(String name, int sellIn, int quality) { /*...*/ } Approval Tests has a variety of implementations on a wide range of platforms. You can browse all of the projects at our GitHub Org ...

6 November 2023 Â· 1 min Â· 115 words

🔗 The Little Mocker | 8th Light

The Little Mocker | 8th Light We can say that a Mock is a kind of spy, a spy is a kind of stub, and a stub is a kind of dummy. But a fake isn’t a kind of any of them. It’s a completely different kind of test double.

7 June 2014 Â· 1 min Â· 50 words

📺 Transformation Priority Premise

Uncle Bob Martin walks through the “Prime Factors” kata in Java (29m06s) to illustrate the concept of Transformation Priority Premise as a way to address the common complaint about TDD: the brainlessness “As the tests get more specific, the code gets more generic.” … and “here’s the list of transformations” (47m53s): So what are these transformations? Perhaps we can make a list of them: ({}–>nil) no code at all->code that employs nil (nil->constant) (constant->constant+) a simple constant to a more complex constant (constant->scalar) replacing a constant with a variable or an argument (statement->statements) adding more unconditional statements. (unconditional->if) splitting the execution path (scalar->array) (array->container) (statement->recursion) (if->while) (expression->function) replacing an expression with a function or algorithm (variable->assignment) replacing the value of a variable. There are likely others. ...

18 March 2014 Â· 1 min Â· 199 words