Java Software Testing tutorials: unit testing, open source, JUnit, Mockito, TestNG, Spring, JGiven, etc.

JUnit Anti-patterns

February 21, 2012 0

The open source JUnit unit testing tool has been a blessing for Java developers. However, many programmers think that it is enough to learn the JUnit API and write a few tests in order to have a well-tested application. This idea is more dangerous than not doing unit tests because it leads to a wrong sense of code quality. Learning JUnit is the easiest part of unit testing your Java code, but writing good tests is the hard part.

Guidelines for Java Testable Design

February 13, 2012 3

Issues with testability boil down to our inability to write tests or the excess trouble we have to go through to get it done. In this article, based on chapter 7 of Unit Testing in Java, author Lasse Koskela shares a set of dos and don’ts for testable design. In the tips provided, he recommends to avoid complex private methods, static methods, logic in constructors and to favor composition over inheritance.

Cucumber with JVM Improvements

January 31, 2012 0

Cucumber-JVM is a pure Java implementation of Cucumber, a software testing tool that support Behavior Driven Development with plain text specifications and unobtrusive automation in Ruby. Cucumber-JVM supports Clojure, Groovy, Java, JavaScript (Rhino interpreter), Python (Jython interpreter), Ruby (JRuby interpreter) and Scala. It is now written in a native Java-API, which compiles down to fast JVM bytecode. It enables many JVM capabilities and makes it even easier to integrate with your Java applications. Note from the Editor: we had the regret to realize after publication that there is no sound on this video. We should have tested this before ;o(

Testing a Java EE Container with Mockito and Arquillian

January 17, 2012 0

The testing strategy to adopt when you you run your code inside a Java EE container is the topic discussed in this blog post by Antonio Goncalves. To solve this issue, he presents a detailed step by step process to unit test an EJB with Mockito and how to do integration test with and without Arquillian with code samples. His conclusion is that since Java EE 6 it is now easy to use container and services in an embedded mode. Unit testing is good to test business code or code in isolation (mocking external components) but you have to remember that you should also use integration testing to test code interacting with external components or services.

Unit Testing in Java: A Sleeping Snail

November 28, 2011 5

In the context of Java unit testing, a sleeping snail is a test that’s sluggish and takes (relatively speaking) forever to run because it relies on Thread#sleep and arbitrarily long waits to allow threads to execute before performing assertions or continuing with the workflow under test. In this article, based on chapter 5 of Unit Testing in Java, author Lasse Koskela explains this code smell and the appropriate deodorant with an example

Testable Enterprise Development with Arquillian

November 3, 2011 0

This presentation addresses the missing link in Enterprise Java development: simple, easy integration testing. You will learn how the simplified component model of Java EE can be applied to testable development.

Effective Mockito

October 3, 2011 0

Mockito is an open source mocking framework for Java. In this series of blog posts, Holger Staudacher shares his experiences with Mockito. He defines “effective” as arriving at clean test and production code as fast as possible. The first post of Effective Mockito explains how to setup Mockito in the Eclipse IDE for the daily work. The second post focuses on Mockito’s @Mock Annotation.

1 5 6 7 8 9