Archive

Posts Tagged ‘junit’

JUnit: Automatically Managing Mocks

March 11, 2011 Leave a comment

In this article, we will extend JUnit to automatically create and manage mocks for us; dramatically reducing the amount of boilerplate code required to write a test. If you are accustomed to dependency injection, like Spring, you will thoroughly enjoy this.

Read more…

Update: JUnit Articles

February 21, 2011 Leave a comment

My first series of articles on JUnit have all been updated with complete source code, which is now housed in my Google Code repository.

Read more…

Categories: Software Development Tags:

Spring MVC: Integration Testing Controllers

February 14, 2011 47 comments

One of the greatest benefits of Spring MVC is that it removes your dependency on a servlet container. In theory, you should be able to test your controllers, and your entire web stack, from a testing harness like JUnit. In reality, you become just as dependent on the wonderful services offered by DispatcherServlet and a complete WebApplicationContext (request parameter binding, validation, model attributes, request mappings, and aspects such as Spring Security). In this article, I will show you how to create a mock servlet context and WebApplicationContext from within JUnit.

Read more…

JUnit: Generating Tests at Runtime (Part 4: Test Data)

February 10, 2011 Leave a comment

JUnit has become the defacto standard for unit testing in Java. This series will explore how we can extend JUnit to better facilitate the development of reusable tests; reducing the effort required to achieve complete code coverage while minimizing test code maintenance and ensuring quality testing. In this fourth part we extend our factory runner with support for testing runtime generated data.

Read more…

JUnit: Generating Tests at Runtime (Part 3: Testing Properties)

January 27, 2011 Leave a comment

JUnit has become the defacto standard for unit testing in Java. This series will explore how we can extend JUnit to better facilitate the development of reusable tests; reducing the effort required to achieve complete code coverage while minimizing test code maintenance and ensuring quality testing. In this third part we will start taking advantage of our new functionality by writing tests for properties and constructors.

Read more…

Categories: Software Development Tags: ,

JUnit: Generating Tests at Runtime (Part 2: Custom Runners)

January 23, 2011 7 comments

JUnit has become the defacto standard for unit testing in Java. This series will explore how we can extend JUnit to better facilitate the development of reusable tests; reducing the effort required to achieve complete code coverage while minimizing test code maintenance and ensuring quality testing. In this second part we I will discuss the chief means of extending JUnit: custom runners.

Read more…

JUnit: Generating Tests at Runtime (Part 1: Overview)

January 22, 2011 Leave a comment

JUnit has become the defacto standard for unit testing in Java.  This series will explore how we can extend JUnit to better facilitate the development of reusable tests; reducing the effort required to achieve complete code coverage while minimizing test code maintenance and ensuring quality testing.  In this first part we I will discuss the motivations for writing reusable tests and why JUnit, out of the box, is not sufficient.

Read more…

Categories: Software Development Tags: ,
Follow

Get every new post delivered to your Inbox.

Join 36 other followers