O'Reilly logo

Testing with JUnit by Frank Appel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Increasing efficiency with mock frameworks

While hand-crafting test doubles is a skill each unit tester should be able to master, mock frameworks aim to ease stand-in component creation and configuration. Hence, they profess to make your daily testing work more efficient. But as opinions on these tools are divided, this section will clarify the pros and cons and give some examples of decent usage.

The promised land?

"If all you have is a hammer, everything looks like a nail."

There are a couple of frameworks available claiming to simplify the usage of stand-in components. Unfortunately, these libraries do not always do a good job when it comes to the precise test double terminology, [GOUL12], which we've learned in the previous sections. While JMock, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required