Home » Tag Archives: Testing (page 7)

Tag Archives: Testing

Testing Asynchronous Code

Asynchronous code is hard. Everyone knows that. Writing asynchronous tests is even harder. Recently I fixed a flaky test and I want to share some thoughts about writing asynchronous tests. In this post we explore a common problem with asynchronous tests—how to force a test to take a specific ordering between threads, and forcing some operations by some threads to ...

Read More »

Integration testing with Gradle

Unit testing works automatically using Gradle, but if you would like to have a separate set of integration tests you need to do a small exercise. Actually they don’t have to be integration tests at all. This guide shows you how to configure Gradle to use any kind of tests and run them independently from others. I will use Scala ...

Read More »

What the Heck Is Mutation Testing?

In recent times, I came repeatedly upon the term mutation testing. Since the word is that this approach is able to detect test safety net gaps in a way which goes beyond code coverage, I took my time to catch up on the topic and gave it a try. This post summarizes my findings as a quick introduction to the ...

Read More »

Clean Integration Testing with JUnit Rules

java-interview-questions-answers

The benefits of JUnit Rules, especially when dealing with integration testing, can hardly be overrated. In this post, we’ll shine a light on the usefulness of ExternalResource extensions. These simplify fixture control in cases where we have to work with external-resource-abstracting third-party libraries. As an example, we’ll have a look at how to verify the correct retrieval of a list ...

Read More »

When Do You Stop Testing?

There is a software to be tested. There is a team of testers. There is some money in the budget. There is some time in the schedule. We start right now. Testers are trying to break the product, finding bugs, reporting bugs, communicating with programmers when necessary, doing their best to find what’s wrong. Eventually they stop and say “we’re ...

Read More »

Unit testing HTTP calls with LocalTestServer

There are times when you’re unit testing code that is making HTTP calls to a remote server. You could be using a library such as Apache’sHttpClient or Spring’s RestTemplate to do so. Of course, you don’t want to rely on a remote service for your unit tests. Besides the overhead involved (remember that unit test are supposed to be fast) ...

Read More »

A Few Thoughts on Unit Test Scaffolding

When I start to repeat myself in unit test methods by creating the same objects and preparing the data to run the test, I feel disapointed in my design. Long test methods with a lot of code duplication just don’t look right. To simplify and shorten them, there are basically two options, at least in Java: 1) private properties initialized ...

Read More »

Unit And Integration Test Reports For Maven Projects In SonarQube

Since SonarQube 4.2. the test report isn’t generated by the Sonar Maven Plugin during a Maven build (see SonarQube’s blog post) . Therefore, the test report has to be generated by another plugin before Sonar Maven Plugin collects the information for the SonarQube server. Here, Jacoco Maven Plugin can help. It has the possibility to generate test report that are ...

Read More »

Using Junit Test Name

Name your tests When we create Junit test usually there is no practical use of the name of the method. The Junit runner uses reflection to discover the test methods and since version 4 you are not restricted to start the name of the method with test anymore. The name of the test methods are there for documentation purpose. There ...

Read More »