Code coverage on integration tests?

Update: This post is now available at a new location:
https://blog.ngeor.com/2018/08/11/code-coverage-on-integration-tests.html

Should you collect and measure code coverage on integration tests or only unit tests? In this post I’ll share some thoughts on this topic.

Continue reading Code coverage on integration tests?

Advertisements

AssertJ cheatsheet

Update: This post is now available at a new location:
https://blog.ngeor.com/2018/04/22/assertj-cheatsheet.html

AssertJ is a an assertions library for unit tests in Java that is well worth considering. Here are some examples.

Continue reading AssertJ cheatsheet

Using sinon stubs

Update: This post is now available at a new location:
https://blog.ngeor.com/2016/05/28/using-sinon-stubs.html

In the previous post we had a look at sinon spies. With spies, we are able to determine if a specific function was called or not. Usually the dependencies between units are more interesting, they involve units co-operating, exchanging data and so on. Spies do not suffice. Let’s have a look at another technique, using stubs. Continue reading Using sinon stubs

Using sinon spies

Update: This post is now available at a new location:
https://blog.ngeor.com/2016/05/21/using-sinon-spies.html

In the previous post, we implemented a new feature for our calculator: it makes a bell sound when you divide by zero. The bell is a simple function that the calculator calls and it is provided as a constructor dependency. We wrote a unit test for this as well, but the code for that is a bit verbose. Let’s see how we can use a mocking library like sinon to reduce and standardize the testing code. Continue reading Using sinon spies

The division by zero bell – Dependencies in unit tests

Update: This post is now available at a new location:
https://blog.ngeor.com/2016/05/14/the-division-by-zero-bell-dependencies-in-unit-tests.html

We left our calculator in the previous post in a decent state, being able to do the four basic mathematical operations. In the special case of division by zero, we want the calculator to make a noise like a bell. Let’s see what we can do about this. Continue reading The division by zero bell – Dependencies in unit tests

What is code coverage?

Update: This post is now available at a new location:
https://blog.ngeor.com/2016/05/07/what-is-code-coverage.html

Last time we had a look at test driven development and our calculator learned how to do multiplication. In this post, we’ll add division and talk a bit about code coverage and unit test quality.

Continue reading What is code coverage?