Home » Tag Archives: Testing (page 13)

Tag Archives: Testing

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 »

Fast Remote Service Tests

java-interview-questions-answers

Testing code that interacts with remote services is often pretty hard. There are a lot of tradeoffs that influence what tests you can write and the amount of tests to write. Most of the times you have zero control over the data you get from the service, which makes assertions tough to say the least. A while ago I used ...

Read More »

Getting started with Mocking in Java using Mockito

mockito-logo

We all write unit tests but the challenge we face at times is that the unit under test might be dependent on other components. And configuring other components for unit testing is definitely an overkill. Instead we can make use of Mocks in place of the other components and continue with the unit testing. To show how one can use ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close