Integration Testing

10 Most Popular Blog Posts of 2014

The year 2014 is almost over, and this means that it is time to publish the most popular blog posts that I wrote during this year. I selected these blog posts by using Google Analytics. I selected all blog posts that were published during 2014 and picked the blog posts that had the most page […] Read more

Spring From the Trenches: Using Null Values in DbUnit Datasets

If we are writing integration tests for an application that uses Spring Framework, we can integrate DbUnit with the Spring testing framework by using Spring Test DbUnit. However, this integration is not problem free. Often we have to insert null values to the database before our tests are run or verify that the value saved […] Read more

Writing Tests for Data Access Code - Data Matters

When we write tests for our data access code, we use datasets for two different purposes: We initialize our database into a known state before our data access tests are run. We verify that the correct changes are found from the database. These seem like easy tasks. However, it is very easy to mess things […] Read more

Writing Clean Tests - To Verify Or Not To Verify

When we write unit tests that use mock objects, we follow these steps: Configure the behavior of our mock objects. Invoke the tested method. Verify that the correct methods of our mock objects were invoked. The description of the third step is actually a bit misleading, because often we end up verifying that the correct […] Read more

Writing Tests for Data Access Code - Don't Forget the Database

When we write tests for our data access code, we must follow these three rules: Our tests must use the real database schema. Our tests must be deterministic. Our tests must assert the right thing. These rules are obvious. That is why it is surprising that some developers break them (I have broken them too […] Read more