Related Topics: Java IoT

Java IoT: Article

Developer Testing Is 'In'

An interview with Alberto Savoia and Kent Beck

A few weeks ago Agitar Software announced that Kent Beck had joined their team. I sat down and talked with Alberto Savoia, CTO, and Kent Beck, Agitar Fellow, to find out what prompted the move and what Agitar is up to that is so exciting.

JDJ: Kent and Alberto, why each other?

Beck: I think the primary motivation for the move is that Agitar is supporting very similar things that I have been working on for a number of years. You have a kind of leverage from working with a commercial company that you just don't have as an individual. The technology is also very interesting.

For 50 years it has been okay for the IT group to be sort of closed and not allow the business side to see what is going on until the end. The trend today is toward more transparency. Developer testing is one form of transparency or accountability. In the past business wrote a check and IT delivered something, but what was delivered was not always sufficient. Developer testing (and thus Agitator and Agitar) is one means of raising the level of transparency and accountability. The other thing is that developer testing makes the developer's job better; it lets you design better; it lets you do your job with confidence; and it lets you sleep better.

Savoia: Agitar probably would not exist if not for Kent and his contributions of XP and JUnit. Since XP is now cool, testing is now by inference cool. I always thought that developer testing is something we should have been doing all along and XP has made it legitimate for developers to test. More important, it is one thing to just say "you should be doing testing"; it's another thing entirely to give developers a tool in the form of JUnit to help them do developer testing.

It's great to have Kent since he is the one who started this whole thing. Also, as we go forward in making developer testing ubiquitous, Kent's vision is going to be extremely influential in the way that we evolve Agitar.

JDJ: Is developer testing a fad?
Developer testing is something that should have been done from day one. For whatever reason developers abdicated this responsibility. Now with XP and JUnit, developer testing is making a comeback, but should have always been here.

Over the past year or so I've talked to literally hundreds of developers and development managers and none of them could make a good argument for not doing developer testing. The thing that comes up though is something I call the developer testing paradox, even though everyone thinks that developer testing is good. It's like motherhood and apple pie - everyone thinks it's a good idea but it's not nearly as widely adopted as it should be. This is the paradox: Why is something so good practiced so infrequently? I believe it's because there are insufficient tools and processes to make developer testing more efficient and effective, and without these processes and tools it will be hard for developer testing to become as widespread as we believe it should be.

The other benefit we feel that you get out of developer testing is early and frequent feedback on your design. The first-order effect is great, a reduction in bugs, but the second-order effect of having better overall designs is probably even more valuable. With developer testing you get early feedback on the coupled (or not) nature of your design. If your design is highly coupled, you'll have complex setup and teardown. If your design is loosely coupled, you'll have a much easier time testing and a more flexible system.

JDJ: Is the developer testing that does exist sufficient?
We have some empirical data that suggests that most IT shops that implement developer testing see around 30% of their developers become "test infected." Even if management decides to stop the unit testing effort, these developers would continue to do developer testing because they have realized the benefits.

The other 70% must have been immunized in their childhoods; the minute the pressure is off to build unit tests, they abandon developer testing and go back to writing lots of code with little testing.

The group who writes tests tends to write good tests, and their tests fail. Meaning that the good tests will find and prevent bugs. On the other hand, the group of developers who don't get test infected, write tests that almost always pass. These tests usually don't find bugs.

JDJ: Is this why we all too often see a system with a large set of developer tests fail when it's delivered to a testing group?
Exactly, this problem has a name: the pesticide paradox. Your code evolves to pass the unit tests; if you don't continue to increase the "dose" of the pesticide (the tests), pretty soon bugs adapt to the tests that you do have.

JDJ: Is developer testing increasing in the enterprise? What are you seeing among your clients?
The rarest of all is the company that decided to do developer testing, trained their whole team, and have been doing developer testing for quite a while, and are seeing success with this method. Usually these teams are led by people who are test infected; thus developer testing becomes part of the culture.

The largest group comprises companies that realize that testing is the correct thing to do. But when they try to implement they run into a set of problems. The primary one is that it takes a lot of time to test code and they don't know where that time will come from.

Finally, there are the companies that want to do developer testing but they just don't know where to start. Perhaps there are a few developers who are test infected but it's not something that is part of the team. I have yet to meet a team that says, "Hey, Alberto, we have two weeks with nothing to do. We were thinking of trying out developer testing." Developers always have something to work on, something to do. Moving to a developer-testing mindset is often difficult to do.

JDJ: In what ways does Agitator help solve these issues that you are seeing?
 The main problem that I encountered when trying to instigate developer testing at Google was the time it takes to write the tests. If developers have to write 300-400 lines of test code to test 100 lines of source code, even though it's the right thing to do, they are making a large investment. The way that Agitator helps with this is by recognizing that much of testing is combinatorial in nature. For example, every if statement in your code needs two tests written. So writing tests by hand is great for particular test cases that you have thought about. Then you want to do exploratory testing and think about all the things that could happen.

I don't believe that code is the correct metaphor for testing. For instance, just like a spreadsheet is the correct metaphor for getting a bunch of calculations done or generating a graph. You don't care about all the stuff that goes on under the hood. You want to give the spreadsheet the input data, a list of formulas, and then have the result. A spreadsheet raises the level of abstraction to the things that you care about. Similarly Agitator raises the level of abstraction of the testing tasks to the components that are important. Those components are the test data and the assertions. The unnecessary distraction of the framework code is below the level of abstraction.

Along those same lines Agitator lowers the barrier to entry for developer testing thus making developer's lives more productive and more fun. In addition the tool also gives a means to measure what is going on inside the project. If you look at what everyone on the team is doing with Agitator and rolled that, you have a much more precise view of what is going on inside.

JDJ: What level of metrics is the Agitator able to provide?
 We have spent a lot of time thinking about metrics. In fact our Dashboard product is all about metrics, and we have learned a lot of valuable lessons. When you want to institute developer testing, it's important to focus on positive metrics, in other words metrics that go up with better testing. Let me give you an example of one of the metrics reported by the Dashboard; we call it "Test Points." Whether you use JUnit or Agitator, every assert statement, for example, asserting that add(2,2) returns 4 is a test point. That is a metric that is positive. As that number grows, we can feel good. This metric is in contrast to traditional metrics like "the number of bugs found." If you are doing developer testing, presumably you won't find a lot of bugs with the tests because the tests help you prevent bugs in the first place.

Another metric that we use is percentage of classes or methods that have tests. Here the goal is very simple: have a test class for each class. There should be symmetry here. Measure how this metric grows as you achieve the goal that you have set for your group, then you can start to add a test for each method. As you achieve the goal you have for the number of methods touched by a test, you can get even more aggressive. However, this positive metric gives the team something positive to focus on and move toward. Instead of measuring your failures, you have favorable measurements to look at.

JDJ: Do you have any metrics regarding the use of Agitator over time? Something like, before developer testing there were so many bugs per 1,000 lines of code and after using developer testing the bug count fell to fewer bugs per 1,000 lines.
We have been doing developer testing on Agitator from the beginning and we currently have more than 20,000 test points for Agitator that run several times a day. It typically discovers a few bugs, and when we do major open-heart surgery on the code it finds many problems that we then fix.

Since we have been doing developer testing from the beginning, it's hard to offer a contrast. I can, however, point you and your readers to a recorded Webinar on our Web site (www.agitar.com) in which Jayson Minard of Abebooks.com talks about their use of Agitator. In a recent quarter they experienced zero downtime because of their use of developer testing and the Agitator. But even so, I still tend to go by gut feelings. The fact that I have 25,000 tests keeping the code clean and, if something goes wrong, I get red flags all over the place, makes me feel a lot better than a particular set of numbers.

JDJ: Do you see the metrics generated by the Dashboard being misused, or is the test-point metric harder to misuse than coverage alone.
I believe in code coverage, but coverage without assertions is like testing a calculator by pushing the buttons for three hours and never looking at the display. I can say that the calculator did not catch on fire but I can't say if it functioned correctly. For example, when an application starts up, you could see as much as 30% code coverage, but you have not discovered that it stated correctly since just starting does not run any assertions. What we do is create a mapping between code coverage and assertion coverage. The theory is that a method is "covered," but if there are no assertions for that method, the coverage does not get counted in the test points metric. Sure it is possible that the method has been tested indirectly, but without a direct test I can't relax and sleep well at night until I have that level of testing. Furthermore if your code cannot be tested at the class and method level your code might not be unit testable and therefore has some likely coupling problems.

JDJ: How does the Agitator fit into a typical developer process?
We ran an experiment (documented at www.developertesting.com) where we did a project test first using JUnit. The interesting thing is that when you do this kind of testing, the developer tends to focus on the positive tests, i.e., 2 * 2 is in fact evaluating to 4, which is natural. However, we always fired up Agitator to help us think about the corner cases that we didn't consider during our typical testing. We found two interesting results. We expected the first; namely that the corner cases that Agitator found were indeed busted, e.g., if I pass a string that is too long/short to this method, the code breaks. The other outcome was that Agitator forced us to think through further refactorings that we did not previously consider. This process is documented in the series of articles on this project at developertesting.com (Agitator-driven refactoring). Using JUnit we thought about "localized" refactorings on particular classes, but in bringing in agitation we saw areas where we should do wider refactorings. It showed us more of the global-level dependencies that were not readily apparent without the agitation process.

JDJ: Where are you headed with the tool set? What's next?
Our vision and one of the reasons we hired Kent Beck is that right now developer testing seems to be the exception rather than the rule. Our goal is to reverse that in the next three to four years. Our product goal is to make Agitator more and more integrated with the development process to assist in the movement toward a major shift into developer testing in the industry.

We are also developing new and interesting ways to display the mountain of information that we gather with the Dashboard. For example, you can see "risky" classes. Risk is a combination of the complexity of the class and the dependencies on that class. With the Dashboard we are headed to more summarization of the information we gather as well as giving people some data on a successful project so that they have something to compare against.

More Stories By Bill Dudney

Bill Dudney is Editor-in-Chief of Eclipse Developer's Journal and serves too as JDJ's Eclipse editor. He is a Practice Leader with Virtuas Solutions and has been doing Java development since late 1996 after he downloaded his first copy of the JDK. Prior to Virtuas, Bill worked for InLine Software on the UML bridge that tied UML Models in Rational Rose and later XMI to the InLine suite of tools. Prior to getting hooked on Java he built software on NeXTStep (precursor to Apple's OSX). He has roughly 15 years of distributed software development experience starting at NASA building software to manage the mass properties of the Space Shuttle.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
Femi 02/16/05 02:05:35 PM EST

Very nice tool, big question... is there a community edition that can be used to 'infect' those of us without deep pockets with the joy of developer testing?

A free edition of Agitator would go a long way to spreading the message. They can remove the bells and whistles and just give the bare bones to the rest of us. I gave up using Rational Rose because while the corporations I work for can afford it, my little startup company cannot (and don't preach to me about 'investment' unless you're willing to give me a contract!)

Latest Stories
SYS-CON Events announced today that TidalScale, a leading provider of systems and services, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale has been involved in shaping the computing landscape. They've designed, developed and deployed some of the most important and successful systems and services in the history of the computing industry - internet, Ethernet, operating s...
Though cloud is the future of enterprise computing, a smooth transition of legacy applications and systems is critical for seamless business operations. IT professionals are eager to start leveraging the cost, scale and other benefits of cloud, but with massive investments already in place in existing infrastructure and a number of compliance and resource hurdles, it can be challenging to move to a cloud-based infrastructure.
In his general session at 21st Cloud Expo, Greg Dumas, Calligo’s Vice President and G.M. of US operations, will go over the new Global Data Protection Regulation and how Calligo can help business stay compliant in digitally globalized world. Greg Dumas is Calligo's Vice President and G.M. of US operations. Calligo is an established service provider that provides an innovative platform for trusted cloud solutions. Calligo’s customers are typically most concerned about GDPR compliance, applicatio...
Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
We all know that end users experience the Internet primarily with mobile devices. From an app development perspective, we know that successfully responding to the needs of mobile customers depends on rapid DevOps – failing fast, in short, until the right solution evolves in your customers' relationship to your business. Whether you’re decomposing an SOA monolith, or developing a new application cloud natively, it’s not a question of using microservices – not doing so will be a path to eventual b...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, will discuss how from store operations...
In a recent survey, Sumo Logic surveyed 1,500 customers who employ cloud services such as Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP). According to the survey, a quarter of the respondents have already deployed Docker containers and nearly as many (23 percent) are employing the AWS Lambda serverless computing framework. It’s clear: serverless is here to stay. The adoption does come with some needed changes, within both application development and operations. Tha...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, will lead you through the exciting evolution of the cloud. He'll look at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering ...
Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
In his session at 21st Cloud Expo, Michael Burley, a Senior Business Development Executive in IT Services at NetApp, will describe how NetApp designed a three-year program of work to migrate 25PB of a major telco's enterprise data to a new STaaS platform, and then secured a long-term contract to manage and operate the platform. This significant program blended the best of NetApp’s solutions and services capabilities to enable this telco’s successful adoption of private cloud storage and launchi...
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
Transforming cloud-based data into a reportable format can be a very expensive, time-intensive and complex operation. As a SaaS platform with more than 30 million global users, Cornerstone OnDemand’s challenge was to create a scalable solution that would improve the time it took customers to access their user data. Our Real-Time Data Warehouse (RTDW) process vastly reduced data time-to-availability from 24 hours to just 10 minutes. In his session at 21st Cloud Expo, Mark Goldin, Chief Technolo...
The next XaaS is CICDaaS. Why? Because CICD saves developers a huge amount of time. CD is an especially great option for projects that require multiple and frequent contributions to be integrated. But… securing CICD best practices is an emerging, essential, yet little understood practice for DevOps teams and their Cloud Service Providers. The only way to get CICD to work in a highly secure environment takes collaboration, patience and persistence. Building CICD in the cloud requires rigorous ar...
Cloud Expo, Inc. has announced today that Andi Mann and Aruna Ravichandran have been named Co-Chairs of @DevOpsSummit at Cloud Expo Silicon Valley which will take place Oct. 31-Nov. 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. "DevOps is at the intersection of technology and business-optimizing tools, organizations and processes to bring measurable improvements in productivity and profitability," said Aruna Ravichandran, vice president, DevOps product and solutions marketing...