Digital Edition

SYS-CON.TV
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: www.enerjy.com.

References

  1. National Institute of Standards and Testing (NIST), 2002. (www.nist.gov)
  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
  5. http://junit.sourceforge.net/doc/faq/faq.htm#best_1
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



ADS BY GOOGLE
Subscribe to the World's Most Powerful Newsletters

ADS BY GOOGLE

"Akvelon is a software development company and we also provide consultancy services to folks who are...
Enterprises are adopting Kubernetes to accelerate the development and the delivery of cloud-native a...
In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objecti...
"Codigm is based on the cloud and we are here to explore marketing opportunities in America. Our mis...
The question before companies today is not whether to become intelligent, it’s a question of how and...
High-velocity engineering teams are applying not only continuous delivery processes, but also lesson...
"Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offe...
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to ...
"CA has been doing a lot of things in the area of DevOps. Now we have a complete set of tool sets in...
"MobiDev is a software development company and we do complex, custom software development for everyb...
In his session at 21st Cloud Expo, James Henry, Co-CEO/CTO of Calgary Scientific Inc., introduced yo...
Agile has finally jumped the technology shark, expanding outside the software world. Enterprises are...
"NetApp is known as a data management leader but we do a lot more than just data management on-prem ...
While some developers care passionately about how data centers and clouds are architected, for most,...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection...
"We're focused on how to get some of the attributes that you would expect from an Amazon, Azure, Goo...
Data scientists must access high-performance computing resources across a wide-area network. To achi...
"We're developing a software that is based on the cloud environment and we are providing those servi...
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22n...
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22n...