Home » Tag Archives: Testing (page 13)

Tag Archives: Testing

Are integration tests worth the hassle?

software-development-2-logo

Whether or not you write integration tests can be a religious argument: either you believe in them or you don’t. What we even mean by integration tests can lead to an endless semantic argument. What do you mean? Unit tests are easy to define they test a single unit: a single class, a single method, make a single assertion on the behaviour ...

Read More »

What are Mockito Extra Interfaces?

mockito-logo

Mockito is my favored little helper if it comes down to write light weight JUnit tests. It is very useful to replace the ‘real’ dependencies of a unit under test easily by mocks if necessary. In particular when working on the borderline to framework APIs such dependencies can otherwise be very expensive to setup. But sometimes the situation is a ...

Read More »

JUnit ExpectedException rule: beyond basics

java-logo

There are different ways of handling exceptions in JUnit tests. As I wrote in one of my previous posts, my preferable way is using org.junit.rules.ExpectedException rule. Basically, rules are used as an alternative (or an addition) to methods annotated with org.junit.Before, org.junit.After, org.junit.BeforeClass, or org.junit.AfterClass, but they are more powerful, and more easily shared between projects and classes. In this ...

Read More »

Getting JUnit Test Names Right

junit-logo

Finding good names is one of the challanges of crafting software. And you need to find them all the time and for everything – classes, methods, variables, just to name a few. But what makes a name a good name? To quote Oncle Bob: ‘Three things: Readability, readability, and readability!’ Which he defines later one by clarity, simplicity and density ...

Read More »

The Importance of Unit Testing

software-development-2-logo

I’m currently working on an enhancement to an existing insurance premium rating algorithm. Anyone who has done work in insurance (whether it be in IT or on the business side) is probably well aware of how complex this can become. Consequently, any significant enhancement to such a system is quite likely to be fraught with pitfalls and setbacks, and that’s ...

Read More »

Parameterized JUnit tests

junit-logo

Sometimes you encounter a problem that just screams for using “parameterized” tests rather than copy/pasting the same method many times.   The test method is basically the same and the only thing that changes is the data passed in.  In this case, consider creating a test case that utilitizes the ” Parameterized” class from JUnit. I recently ran into a ...

Read More »

The Test Waste Ratio

software-development-2-logo

Remember the days when bugs were just part of life? I mean a big part. If you recall those dark ages, we’ve spent most of our time fixing bugs and introducing others. In our spare time, we got to work on new stuff. Today is different, there are a lot less bugs. So we get to work more on the ...

Read More »

Why shouldn’t I test private methods?

software-development-2-logo

Newcomers to TDD ask some interesting questions, here’s one I was asked recently: testing private methods is bad, but why? How did we get here? If you’re trying to test private methods, you’re doing something wrong. You can’t get to TDD nirvana from here, you’re gonna have to go back. It all started with an innocuous little class with an innocuous ...

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.