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


SUSE is a German-based, multinational, open-source software company that develops and sells Linux pr...
Lori MacVittie is a subject matter expert on emerging technology responsible for outbound evangelism...
NanoVMs is the only production ready unikernel infrastructure solution on the market today. Unikerne...
Big Switch's mission is to disrupt the status quo of networking with order of magnitude improvements...
Yottabyte is a software-defined data center (SDDC) company headquartered in Bloomfield Township, Oak...
Dynatrace is an application performance management software company with products for the informatio...
Chris Matthieu is the President & CEO of Computes, inc. He brings 30 years of experience in developm...
All in Mobile is a mobile app agency that helps enterprise companies and next generation startups bu...
Every organization is facing their own Digital Transformation as they attempt to stay ahead of the c...
Blockchain is a new buzzword that promises to revolutionize the way we manage data. If the data is s...
CloudEXPO | DevOpsSUMMIT | DXWorldEXPO Silicon Valley 2019 will cover all of these tools, with the m...
Serveless Architectures brings the ability to independently scale, deploy and heal based on workload...
I spend a lot of time helping organizations to “think like a data scientist.” My book “Big Data MBA:...
The standardization of container runtimes and images has sparked the creation of an almost overwhelm...
Whenever a new technology hits the high points of hype, everyone starts talking about it like it wil...
Wasabi is the hot cloud storage company delivering low-cost, fast, and reliable cloud storage. Wasab...
To Really Work for Enterprises, MultiCloud Adoption Requires Far Better and Inclusive Cloud Monitori...
David Friend is the co-founder and CEO of Wasabi, the hot cloud storage company that delivers fast, ...
In addition to 22 Keynotes and General Sessions, attend all FinTechEXPO Blockchain "education sessio...
Early Bird Registration Discount Expires on August 31, 2018 Conference Registration Link ▸ HERE. Pic...