Digital Edition

Applying a Java Unit Testing Framework
Applying a Java Unit Testing Framework

For Best Results
For best results, JUnit should test all lines of code that could potentially contain bugs. If defects aren't being reported and the design responds well to change, then your unit testing is probably sufficient. If your team is still spending too much time fixing bugs, and the design is difficult to grow, they need to write more tests.

If your code is difficult to test, this presents an opportunity to improve your design.

If you improve your design so that it is easier to test, a better design will usually result.

Run all tests as often as possible, ideally every time you change your code. All unit tests should run at 100 percent pass rates. Frequent testing will give you confidence that your changes didn't break anything and has the additional benefit of lowering your overall stress level.

The output from these tools is the beginning of increased visibility into the development process, providing metrics that measure improved quality practices.

Automation/repeatability – Level 3
A unit test, by definition, is fully automated, non-interactive and binary—it either passes or fails. In the case of Java, a unit is usually a single class.

Automated unit testing lets you run tests repeatedly (regression testing), and collect tests into suites as you develop your code, promoting the evolution of your design. The key to attaining this step is that your team must have successfully implemented the first two levels.

Measurement – Level 4
While the previous levels provide a good foundation for quality practices, with resulting productivity improvements, quality can only be realized when output from these processes (or a combination of them) can be measured. This is the level, therefore, where organizations can begin to concern themselves with quality results.

To introduce new development practices, metrics must be used to identify where resource should best be deployed. For example, with unit testing, pass rate is a key measurement. Is it enough that all 5,000 unit tests have passed? If 100 percent of those tests pass, this may be a sufficient level of quality. However, if the 5,000 unit tests only cover 20 percent of the code base, the code quality level is less certain.

Only by measuring and combining results, can organizations obtain a clear picture of unit testing coverage, and ultimately code quality.

Analytics – Level 5
After launching a unit testing initiative, organizations can start collecting metrics from all developers, and then combine the results by team. Analyzing data that has been measured allows managers to identify behavior issues or the lack of sufficient process, when it comes to unit testing. This will allow them to track individual behaviors, so they can focus on training and resource allocation. Pulling this data together into a single user interface will provide the team with instant visibility into developer behaviors.

Trend Analysis – Level 6
Tracking unit testing trends over time allows organizations to promote best practices through training, mentoring or other assistance, as may be required.

If an organization is combining data from different sources, analyzing trends, and then using the results to adjust and streamline unit testing, they are to be congratulated. At this stage, they have optimized the efficiency and quality of projects and deployed applications, with a resulting decrease in customer complaints.

Java testing frameworks such as JUnit, however, work at the individual developer level and provide metrics in snapshot format. JUnit does not consolidate data from each individual client copy; or show who is responsible for untested code across an entire code set.

What is needed is a tool that not only consolidates code coverage information from all developers, but also tracks metrics over time. For example, a measured activity of code coverage may show that 70 percent of the code base is covered by unit tests. At first glance, this may seem like a good figure; but if last week's figure was 80 percent or the code base has halved in size from the previous week, how does this figure compare? These measurements must be taken in context, by individuals and by the entire team.

Refining the quality process is an ongoing task, especially with external factors enforcing the change process (such as Sarbanes-Oxley.). However, if an organization is at this point in the process, these changes will be easier to implement, with less financial impact, because a unit testing framework is already in place for all developers, allowing organizations to take positive action.

Enerjy CQ2
Enerjy CQ2 provides visibility into the development process by consolidating data from key development processes and tool.

  • Unit testing results
  • Code coverage percentages
  • Best practices and compliance to coding standards
  • Overall activity
  • Bug detection
Using these metrics, development managers can optimize the performance of their teams, thus minimizing time wasted on avoidable rework, tracking down bugs, or in lengthy or ineffective code reviews. Development teams can quantify and improve application quality at the beginning of the development process where it is easier and more cost-effective to address problems.

Enerjy CQ2 provides a turnkey solution including: Discovery, Recommendation, Installation, Implementation and Training.

Who Is Enerjy Software?
Enerjy develops Java™ software integrity solutions for development managers to continuously improve the quality of their application development projects. Enerjy CQ2 technology provides visibility into a quality-driven development process to aid development teams in delivering projects to specification with reduced coding errors by the required target date.

Development managers can now optimize the performance of their development team, thus minimizing time wasted on avoidable rework, on tracking down bugs, and in lengthy or ineffective code reviews.

Enerjy Software is a division of Teamstudio, Inc. With headquarters in Beverly, Massachusetts, Teamstudio also has offices in the UK, France, and Japan. To learn more about software integrity solutions designed to improve application quality and enhance developer productivity, please visit Enerjy's Web site at:


  1. National Institute of Standards and Testing (NIST), 2002. (
  2. Standish Group, Chaos Report 2003.
  3. "Leveraging Legacy System Dollars for E-business," Erlikh, L. (2000), (IEEE) IT Pro, May/June 2000, 17-23
  4. "Google: Ten Golden Rules," Eric Schmidt and Hal Varian, Newsweek, December 2, 2005
About Java News Desk
JDJ News Desk monitors the world of Java to present IT professionals with updates on technology advances, business trends, new products and standards in the Java and i-technology space.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

Subscribe to the World's Most Powerful Newsletters


Containers and Kubernetes allow for code portability across on-premise VMs, bare metal, or multiple ...
"Akvelon is a software development company and we also provide consultancy services to folks who are...
Enterprises are striving to become digital businesses for differentiated innovation and customer-cen...
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, ...
In this presentation, you will learn first hand what works and what doesn't while architecting and d...
Most DevOps journeys involve several phases of maturity. Research shows that the inflection point wh...
Modern software design has fundamentally changed how we manage applications, causing many to turn to...
In his session at 20th Cloud Expo, Scott Davis, CTO of Embotics, discussed how automation can provid...
In his session at 20th Cloud Expo, Mike Johnston, an infrastructure engineer at, discu...
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22...
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT...
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing w...
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held Novemb...
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018,...
Dynatrace is an application performance management software company with products for the informatio...
Disruption, Innovation, Artificial Intelligence and Machine Learning, Leadership and Management hear...
SYS-CON Events announced today that DatacenterDynamics has been named “Media Sponsor” of SYS-CON's 1...
SYS-CON Events announced today that IoT Global Network has been named “Media Sponsor” of SYS-CON's @...
SYS-CON Events announced today that has been named “Media Sponsor” of SYS-CON's 22n...
A valuable conference experience generates new contacts, sales leads, potential strategic partners a...