Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Continuous Integration and Testing

Easy Unit and Integration Code Coverage

This example shows how to generate coverage for unit and integration tests using Maven and Sonar.
It uses very simple techniques and should only take 10-15 minutes to get running in any existing Maven build.
It can be used across unit, integration, ATDD or any other kind of test suite.
The coverage results are shown in Sonar.

Whats Coming?

My previous post showed how we to use JUnit categories to easily split unit and integration test suites.

Read more ...

 

Unit and Integration Tests With Maven and JUnit Categories

Introduction

This example shows how to split unit and integration tests using Maven and JUnit categories.
It is especially useful for existing test suites and can be implemented in minutes.

Why use this?

My previous post showed how we to use a maven profile to split unit and integration tests.
http://johndobie.blogspot.co.uk/2011/06/seperating-maven-unit-integration-tests.html

Read more ...
 

Code Forensics

How do you know if using code metrics really does help to produce code with fewer bugs.
I am convinced they do, but how can I possibly prove it?

All projects have historic data. This is usually stored in your bug tracking and source code control tools.
We can use the data stored in these systems to perform ‘code forensics.’
We use the historic data from real issues to see if they could have been avoided.


Read more ...
 

Unit Test Code Coverage With Maven And Jacoco

Insert title here It’s easy to collect unit test code coverage because all of the common tools are geared up for it.
This article will explain how you can add unit test coverage to your Maven application in 10 minutes.
We will use the excellent Jacoco code coverage library to show how easy it is.

Examples

All of the examples come from this article.
http://johndobie.blogspot.com/2011/11/test-doubles-with-mockito.html


Read more ...
 

Mocks And Stubs - Understanding Test Doubles With Mockito

IntroductionA common thing I come across is that teams using a mocking framework assume they are mocking.
They are not aware that Mocks are just one of a number of 'Test Doubles' which Gerard Meszaros has categorised at xunitpatterns.com.
It’s important to realise that each type of test double has a different role to play in testing. In the same way that you need to learn different patterns or refactoring’s, you need to understand the primitive roles of each type of test double. These can then be combined to achieve your testing needs.

Read more ...

 

Maven Integration Testing And Spring Restful Services

Introduction

My original blog showed how to seperate maven unit and integration tests using a very simple example. http://johndobie.blogspot.com/2011/06/seperating-maven-unit-integration-tests.html Since then a lot of people asked me for a more realistic example than the one used originally. This post shows how you split your unit and integration tests using the original method in a realistic environment where the application is actually deployed to a server.

Read more ...

 

A Free EC2 Cloud Based Jenkins And Sonar Setup

Introduction

My original blog showed how to seperate maven unit and integration tests when doing continuous integration.
http://johndobie.blogspot.com/2011/06/seperating-maven-unit-integration-tests.html

This example builds on this to provide a platform to run the example.  We use a free Amazon EC2 cloud based solution to show how to deploy Jenkins and Sonar.  This is a low power server but it is useful for infrequent use.

The steps are very simple

Read more ...

 

Maven Multi-Module With Sonar and Jacoco

1. Introduction

This blog shows how to seperate your unit and integration tests in a multi-module maven project whilst providing seperate test coverage results for each.

Read more ...

 

Separating Code Coverage With Maven, Sonar and Jacoco

1. Introduction
In this example I will expand upon my previous example of keeping your unit and integration tests in separate packages, and explain how to also produce code coverage statistics.

For this I continue to use Maven, whilst adding Sonar and Jacoco to provide the code coverage.
You can run the example below, but you will need to read the first article here to understand it.


Read more ...
 

Separating Maven Unit & Integration Tests

1. Introduction

In this example I will show how you can perform a standard Maven build whilst keeping your unit and integration tests in separate packages.

Other techniques specify using either a naming convention or a separate module to do this.
This example allows true package separation and is self contained in a single profile so it can easily be used across projects. Alternative profiles can also be created for different types of test.

This solution lends itself well to generating code coverage metrics using Sonar and Jacoco.

Read more ...
 
Syndicate content