Home » Tag Archives: Testing

Tag Archives: Testing

Unit testing HTTP calls with LocalTestServer

java-logo

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

java-logo

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

apache-maven-logo

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

junit-logo

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 »

Getting Started With Gradle: Integration Testing

gradle-logo

Because the standard project layout of a Java project defines only one test directory (src/test), we have no standard way to add integration tests to our Gradle build. If we want to use the standard project layout, we can add integration tests to our Gradle build by using one of the following options:       We can add our ...

Read More »

4 Creative Ways to Test Your Code in Production

software-development-2-logo

What are some considerations and things to think about if I want to get the most out of testing in my production environment? Production environments are a different beast. No matter how much effort you put into staging environments, you’re only truly getting real life conditions, and therefore real life data, in production. Everyone does some degree of testing in ...

Read More »

JUnit: Testing Exceptions with Java 8 and AssertJ 3.0.0

junit-logo

AssertJ 3.0.0 release for Java 8 makes testing exceptions much easier than before. In one of my previous blog post I described how to utilize plain Java 8 to achieve this, but with AssertJ 3.0.0 much of the code I created may be removed. Warning: this blog post contains mostly the code examples.     SUT – System Under Test ...

Read More »

TDD, Code review and Economics of Software Quality

software-development-2-logo

To understand the value of Junits (developer tests), try maintaining, or worst, refactoring a code base that has none. The cost of  maintaining such code is so high, that in most cases, it gets replaced instead of being improved or enhanced. The developer tests leads to ease of  maintenance and thus enable change. They are now a critical part of ...

Read More »

Automated testing of REST-services

junit-logo

Despite I’m a Java and Scala developer I still passioned a lot in testing of software. If to be more precisely – web applications. It’s really interesting to develop web app and be confident that the apps have a good quality. When I’ve started a career the most popular web architecture was MVC (Model View Control) and there was pretty ...

Read More »

Short on Time? Switch to Groovy for Unit Testing

groovy-logo

If you are a programming today, you have most likely heard of Unit Testing or of the Test-Driven Development process. I have yet to run into a programmer that has not heard of both, nor one that says Unit Testing isn’t important. In casual discussions, most programmers seem to feel that Unit Tests are very important and that Test-Driven Development ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.