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


At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with exp...
When a company wants to develop an application, it must worry about many aspects: selecting the infr...
Financial enterprises in New York City, London, Singapore, and other world financial capitals are em...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with exp...
Darktrace is the world's leading AI company for cyber security. Created by mathematicians from the U...
DevOps has long focused on reinventing the SDLC (e.g. with CI/CD, ARA, pipeline automation etc.), wh...
Cloud Storage 2.0 has brought many innovations, including the availability of cloud storage services...
Most modern computer languages embed a lot of metadata in their application. We show how this goldmi...
At CloudEXPO Silicon Valley, June 24-26, 2019, Digital Transformation (DX) is a major focus with exp...
Every organization is facing their own Digital Transformation as they attempt to stay ahead of the c...
Intel is an American multinational corporation and technology company headquartered in Santa Clara, ...
Data center, on-premise, public-cloud, private-cloud, multi-cloud, hybrid-cloud, IoT, AI, edge, SaaS...
Atmosera delivers modern cloud services that maximize the advantages of cloud-based infrastructures....
Today's workforce is trading their cubicles and corporate desktops in favor of an any-location, any-...
Artifex Software began 25-years ago with Ghostscript, a page description language (PDL) interpreter ...
ShieldX's CEO and Founder, Ratinder Ahuja, believes that traditional security solutions are not desi...
Is your enterprise growing the right skills to fight the digital transformation (DX) battles? With 6...
In an age of borderless networks, security for the cloud and security for the corporate network can ...
Now is the time for a truly global DX event, to bring together the leading minds from the technology...
Moving to Azure is the path to digital transformation, but not every journey is effective. Organizat...