Category Archives: JUnit

Recap: SAU TDD Workshop

About a month ago, I facilitated the first event as part of the Source Allies external mentoring program known as Source Allies University (SAU).

Postcard

 

 

 

 

 

 

 

 

Cecil Williams
Cecil Williams

Latest posts by Cecil Williams (see all)

 

It was an interactive forum and networking event designed to:

  • Cover basics and explore new tricks of Test Driven Development (TDD) in Java
  • Create new code & refactor existing legacy code via TDD
  • Code through a sample project for hands-on experience

Continue reading

Test Driven Groovy: StubFor

After years of being immersed in Java development, I must admit that I got spoiled by its strong and mature ecosystem. Hence, whenever I want to pick up a new technology or programming language the following must be there:

  • Support by my favorite IDE (Eclipse or IntelliJ IDEA)
  • Mature building framework. It does not have to be Maven or Gradle but it needs to be at least better than Ant.
  • Easy TDD. This could be the trickiest one to achieve because not only do I need a testing framework, but it must also be supported by my IDE and build tool. Moreover, it must have an adequate mocking framework.

Groovy easily satisfies those criteria right out of the box. It has awesome support by IntelliJ IDEA, Gradle is written in Groovy and you can write JUnit 3-style unit tests.  

Akrem Saed
Akrem Saed

Latest posts by Akrem Saed (see all)


Continue reading

Code Quality Metrics with Sonar, Part III: Sonar in a Ant-based Java Project

Now we will cover the fun stuff for which we’ve been waiting. In this post, I’ll go over how to setup Sonar for a Java project that utilizes Ant for its build.  I’ll go through the basic steps for installing and running a Sonar instance, and how to use a MySQL database for collecting metrics. Then I’ll go into some details around analyzing a Java project using Ant and Sonar. This involves writing Ant script, pointing to the source codes, analyzing the binaries, analyzing JUnit test cases, analyzing Ecl Emma coverage, etc.

Continue reading

Code Quality Metrics with Sonar, Part II: Overview of Sonar features

What we covered so far ?

In my previous post I covered the reasons why software quality metrics should be collected and why improvements to the code should be made based on those metrics. In this post I’ll be illustrating how Sonar can fulfill the job of collecting metrics and driving decisions.

Sonar goes beyond just collecting and displaying metrics:

  • Sonar can answer the following questions:
    • What are our most critical code quality issues?
    • Where is the highest concentration of code issues?
    • How many working hours will it take to fix the issues?
    • What does the metrics trend look like over the past year?
    • etc.
  • Sonar can be used to track work tickets assigned to team members.

In short, Sonar helps us analyze the situation, take actions, and quantify the improvement.

Continue reading

Code Quality Metrics with Sonar, Part I

What is Sonar and Why it’s Needed?

I was fortunate to be able to attend the 2011 edition of No Fluff Just Stuff . One of my favorite presentations was by Matthew McCullough on Sonar . Hence, when the issue of code metrics was raised at a client, Sonar seemed like the right tool to use.

Our client wanted to explore ways to measure and enforce software and code quality metrics. Their goals were to have quantitative measurements of their code quality and analyze those metrics to come up with a set of benchmark measurements. They wanted to utilize Sonar to discourage bad practices.

Continue reading

Hibernate Logging

Through the years I’ve encountered a recurring requirement. Clients need to log changes to the database for auditing and legal purposes. To satisfy this requirement you could add logging to every save/update/delete call in your code. Or better yet, you could create an aspect that wraps these calls. While these would certainly work Hibernate provides a convenient interceptor.

In this article I will show you how to add a simple logger to Hibernate.
Continue reading