Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Web Development

Change Code Without Fear


Nada is Product Manager of Java Solutions at Parasoft. She holds a bachelor's degree in computer science from the University of California, Los Angeles and can be contacted at [email protected].


Working on an existing code base that has minimal or no tests is like walking on eggshells: Every move you make has the potential to break something. Yet when you're working on software, the damage is not always immediately obvious—at least, not without extensive, system-wide testing. But such validation is not always possible or easy, considering the frequency of change, limited resources, and looming deadlines that most developers face. As a result, many developers commit their additions and modifications, then cross their fingers and hope for the best.

If your code lacks sufficient tests, Behavioral Regression Testing is a technique that provides a fast and easy way to determine if code modifications change or break existing functionality. What is Behavioral Regression Testing? It's a baseline test that captures the project code's current functionality. To detect changes from this baseline, you run your evolving code base against a test suite on a regular basis. In most cases, such a test suite can be generated overnight using automated unit-testing tools. Once this test suite is in place, you can incrementally improve its intelligence and value by adding more test cases, modifying the automatically generated ones, and keeping it in sync with intentional program changes. The resulting test suite serves as a change-detection safety net, letting you modify code without fear of accidentally changing or breaking the code's intended behavior.

The key to making this practice practical is to automate as many tasks as possible so that you can focus your efforts on the few regression-testing tasks that truly require human intelligence. By leveraging automation for this purpose, you gain a reliable way to determine when and how your code modifications impact the rest of the application—with minimal effort.

In this article, I explain how to build, maintain, and extend Behavioral Regression Test Suites that help you write code faster and change it with confidence.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.