testdriven.com Wrangling quality out of chaos

Archive for May, 2005

Whale-first, The end of bugs, Rescue units

05.28.2005 · Posted in Blogosphere

Jomo Fisher uses the whole Test-First whale: "Famously, subsistence hunters use every part of their kill. This makes sense because it’s hard to catch a whale. If you expend that kind of effort, you need to maximize your return. If you don’t then you’ll freeze tail all winter while your neighbor down the coast is toasty warm next to their blubber-oil stove."

Johanna Rothman wants an end to bugs: "The first step in solving problems is to acknowledge that you have them. If you want to deal with the defect problem, stop calling those problems bugs. Bugs may be an acceptable name, but it’s not a helpful name. Call the problems defects or problems or faults — something that will help people realize they need to examine why it’s acceptable to allow defects into the code." Also read Johanna’s follow-up and Keith Ray’s take.

Paul Kenney decides legacy changes are too costly, and that now is the right time: [url=http://www.pjk.us/pjk/blog/index.cfm?event=showEntryForID&entry=EC6B804B-3048-28E9-DABD0EA0A812D44A]Unit tests to the rescue![/url]David J. Anderson publishes some Feature Driven Development benchmark metrics, based on his experience with real projects over the last 6 years.

Chris Jones wonders about the place of iterative development in game development and asks for pointers.

Chris Hanson gives some pointers on Unit testing and Core Data with UnitKit (unit-testing framework for Objective-C).

Sven Gorts re-considers the Single-Assert rule: "A single assert per test is generally considered good unit testing practice. Yet there are times when I prefer to deviate from this rule."

Mathias Meyer reviews Xcode.

Patrick Cauldwell states [url=http://www.cauldwell.net/patrick/blog/PermaLink,guid,f4963798-16fe-49d5-8beb-7d847a0631b1.aspx]code-freeze or tree-locking is counter productive[/url], and suggests using labels: "Code freezes pretty much take the continuous right out of [continuous integration]. The solution, you ask? Labels. I think most people don’t realize how many groovy things you can do with good labeling policy."

Keith Ray also addresses frequent releases in "Can do" not "Have to do": "There’s an idea that XP is only useful for frequently-released projects, and not so useful for projects that ship annually or less often. I would say that XP is useful for both."

Michael Mahemoff discusses Patterns as Refactoring Tools and identifies two main themes: Pattern refactoring for education and Pattern refactoring for development work.

Brian Button posts his slides on Programmer Tests as Agile Documentation from a recent talk at St. Louis OOSIG.

Microsoft recently published a paper on [url=http://research.microsoft.com/research/pubs/view.aspx?type=technical report&id=917]Parameterized Unit Tests[/url]: "Parameterized unit tests extend the current industry practice of using closed unit tests defined as parameterless methods."

Brian Button introduces the next concept in conferencing with "iterative talk" in Agile Speaking.

Just when we thought April Fool was behind us, K. Scott Allen announces DICA as a pairing facilitator.

On your agenda:

Jonathan Cogley will present an MSDN Webcast on Test-Driven Development with NUnitAsp on June 1, 2005, 1pm, in which he intends to transition from TDD principles to UI test driving to the Thycotic.TddStarterKit.

On Tuesday June 7th, Kent Beck will discuss his latest insights on eXtreme Programming and Developer Accountability in a webinar organized by Agitar Software. Details here.

Neil Roodyn is to present on "eXtreme .NET, An Introduction to Better Software Development" at a July half-day conference organized by Scottish Developers in Edinburgh on the 21st of July.

Learning from broken unit tests

05.28.2005 · Posted in Links

When multiple tests break due to a small change those tests can learn us a lot about the code. In this article we take a closer look at how we can use the implicit knowledge carried by the tests to our advantage.

Author: Sven Gorts
Published: May 17, 2005
link

Tags:

PyGUIUnit: Python GUI testing framework

05.28.2005 · Posted in Links

PyGUIUnit is a framework created for testing GUIs. It is built on top of the PyUnit framework, merging seamlessly with it, allowing developers to write tests for GUIs as he would normally do for any other piece of code.

Its current implementation is based on the PyQt framework.
link

PloneSelenium: Plone functional test

05.28.2005 · Posted in Links

PloneSelenium allows you to write functional tests for your Plone site using a single Python Script. The target audience is Python programmers who need more flexibility for writing functional tests than is possible with the standard Selenium HTML table approach.
link

JUnit antipatterns

05.27.2005 · Posted in Links

"The downside of testing is that the unit tests themselves can be buggy or badly written. The following antipatterns were all spotted during code reviews of programmers new to JUnit."

Authors: Annie & Joe Schmetzer
link

How to use Design Patterns: a conversation with Erich Gamma, part I

05.27.2005 · Posted in Links

Among developers, design patterns are a popular way to think about design, but what is the proper way to think about design patterns? In this interview, Erich Gamma, co-author of the landmark book, Design Patterns, talks with Bill Venners about the right way to think about and use design patterns.

Author: Bill Venners
Published: May 23, 2005
link

Pair Programming Illuminated

05.26.2005 · Posted in Links

Pair Programming IlluminatedPair programming is a simple, straightforward concept. Two programmers work side-by-side at one computer, continuously collaborating on the same design, algorithm, code, and test. It produces a higher quality of code in about half the time than that produced by the summation of their solitary efforts. However, nothing is simple where people and personalities are involved–especially people who are accustomed to working alone. The leap to pair programming for a variety of software development projects is one that yields many benefits. However, it is also one that requires careful thought and planning.

Written as instruction for team members and leaders new to pair programming and as an improvement guide for experienced pair programmers, Pair Programming Illuminated explains both the principles underlying this method and its best practices. The authors, drawing on their own extensive experience, explain what works and what does not, what should be emphasized and what should be avoided. Two case studies further illuminate pair programming in practice: one in the context of extreme programming (XP), with which it often is associated, and one linked to a more disciplined software engineering process.

Key topics include:
– Principles for selecting partners
– Practical advice, such as furniture set-up, pair rotation, and weeding out bad pairs
– Seven habits of effective pair programmers

Special appendices include:
– A pair programming tutorial
– An economic analysis of pair programming
– An introduction to test-driven development

With this book in hand, you will quickly discover how pair programming fits the needs of your own organization or project. You then will see exactly how to get started with this method, and how to do it right.

Author: Laurie Williams & Robert Kessler
Published: June 2002
See also: Noel Llopis’ review
link

Tags: ,

OCMock: Mock Objects for Objective-C

05.26.2005 · Posted in Links

OCMock is an Objective-C implementation of mock objects.

This implementation fully utilises the dynamic nature of Objective-C. It creates mock objects on the fly and uses the trampoline pattern so that you can define expectations and stubs using the same syntax that you use to call methods. No strings, no @selector, just simple method invocations.
link

Testing Java Enterprise Applications with Cactus

05.26.2005 · Posted in Links

JUnit is great for both initial testing and regression testing as a project continues. But it doesn’t provide support for testing local interfaces of Enterprise Java Beans or for testing the communication between servlets and EJBs. Marcus Zarra explains how Cactus comes to the rescue.

Author: Marcus Zarra
Published: InformIT, May 20, 2005
link

AnyUnit 1.2 add-in for MSVS 2003 is released

05.24.2005 · Posted in Tools

AnyUnit version 1.2 is now released and ready for download at www.anyunit.com.

AnyUnit is an unit testing environment that allows developers to work with virtually any type of test frameworks, commercial and open source. This release adds VB.NET support, command line test execution, tasklist propagation with test failures, more detailed test runners and a choice to store UT-related information in separate files or directly in solution and projects.

TDD Tools Advisory, May 1-15, 2005

05.16.2005 · Posted in Advisories

The following tools were recently updated:

CruiseControl.NET 0.9
DrJava 20050510-0024
EMMA 2.1.5214
HTMLUnit 1.6
Jetif 1.5.0b1
JTR 2.0
LuntBuild 1.2b2
Refactor! VB beta 2
SQLUnit 4.7
STAF 2.6.8 / STAX 1.5.7
utPLSQL b2.2b2
WSUnit 1.0 CruiseControl.NET 0.9
CruiseControl.NET is an automated Continuous Integration server for the Microsoft .NET platform. It is a functional port of the Java-based CruiseControl to the .NET platform.

DrJava 20050510-0024
DrJava is a lightweight programming environment for Java designed to foster test-driven software development. It includes an intelligent program editor, an interactions pane for evaluating program text, a source level debugger, and a unit testing tool.

EMMA 2.1.5214
EMMA is an open-source toolkit for measuring and reporting Java code coverage. EMMA distinguishes itself from other tools by going after a unique feature combination: support for large-scale enterprise software development while keeping individual developer’s work fast and iterative at the same time. EMMA is so lightweight developers can use it during the process of writing tests instead of waiting for a "test build". This gets code coverage where it belongs: helping with design and implementation before the code is checked in.

HTMLUnit 1.6
HtmlUnit is a java unit testing framework for testing web based applications. It is similar in concept to HttpUnit but is very different in implementation. Which one is better for you depends on how you like to write your tests. HttpUnit models the HTTP protocol, HtmlUnit models the returned document.

Jetif 1.5.0b1
Jetif is a unit-testing framework for Java. It separates the testing data from the test code, records the test result to a text file or database, and logs some message to a simple text log file.

JTR 2.0
A Java framework that helps developers in building test suites. JTR is based on concepts such as Inversion of Control, and is ready for EJB and JMS testing.

LuntBuild 1.2b2
A daily build tool based on Apache Ant. It performs build automation and management totally from a clean web interface.

Refactor! for Visual Basic beta 2
Refactor! for Visual Basic 2005 is a free plug-in from Developer Express Inc., in partnership with Microsoft, that enables Visual Basic developers to simplify and re-structure source code inside of Visual Studio 2005, making it easier to read and less costly to maintain. Refactor! supports more than 15 individual refactoring features, including operations like Reorder Parameters, Extract Method, Encapsulate Field and Create Overload.

SQLUnit 4.7
SQLUnit is a regression and unit testing harness for testing database stored procedures. A SQLUnit test suite would be written as an XML file. The SQLUnit harness, which is written in Java, uses the JUnit unit testing framework to convert the XML test specifications to JDBC calls and compare the results generated from the calls with the specified results.

STAF 2.6.8 / STAX 1.5.7
The Software Testing Automation Framework (STAF) is an open source, multi-platform, multi-language framework designed around the idea of reusable components. STAX is an execution engine which can help you thoroughly automate the distribution, execution, and results analysis of your testcases.

utPLSQL b2.2b2
utPLSQL is a unit testing framework for programmers using Oracle’s PL/SQL language. Developed by Steven Feuerstein, author of many books on the subject, it allows the automated testing of packages, functions and procedures.

wsUnit 1.0
WSUnit is a tool that can help you test Web Service consumers. It provides a predictable and repeatable simulation of a Web Service that is ideal for unit testing. It is also useful when developing web service consumers when the actual web service may not be avaliable due to your remote location or may not have been fully developed itself.

Assert that, Legacy lore, Manager lore and the fabulous toolboy

05.15.2005 · Posted in Blogosphere

Joe Walnes introduces Flexible JUnit assertions with assertThat() using jMock: "Over time I’ve found I end up with a gazillion permutation of assertion methods in JUnit: assertEquals, assertNotEquals, assertStringContains, assertArraysEqual, assertInRange, assertIn, etc. Here’s a nicer way."

Brian Marick identifies three approaches to legacy code: Rewrite and throw away, Refactor into submission, and Strangle. Brian muses as to who will write down the Legacy Patterns of Lore.

Prithee, how worketh the module of logging? Why buildeth not the adapter of database?: "But the new servant of Balazar did not trouble the old servant, for all he wished to know, he found in the web of wiki and the comments of documentation and the tests of unit. And when he trampled on the codebase, the tests of unit did send a red bar to warn him away from sin; and he laid on hands and did heal the problem even before he performed the check of in."

Since we’re on the subject (must be the season), have you heard of The Insane Project Manager from Hell and the Tool Boy?Michael Hunter on test case refactorings: "These problems all combine to make test cases a maintenance nightmare. Anytime the application under test changes — regardless of whether the UI changed a tiny bit or an entire feature was dramatically revamped — every affected test case must be updated. Identifying these test cases can be quite difficult since every test case likely does things slightly differently." Read Test Cases Are Maintenance Hogs.

PHP Kitchen relates Marcus Baker’s response to testing methods that write to the database. John prefers to roll back with ADOdb’s Smart Transactions.

Mike Gunderloy mentions InstallShield 11 has "a new automation API for incorporating InstallShield into automated build processes".

Ian Bicking is starting out with Selenium.

Mike Mason posts his slides and "a bunch of code" from the TDD session at Norway’s Roots Conference.

Execute EJB JUnit Tests in Your Deployed Apps: Extend the life of your JUnit tests

05.14.2005 · Posted in Links

By building a simple JUnit test execution service that runs inside your application, you can support in container test execution via command-line, over HTTP, or even expose test execution as a Web service. Rather than running tests standalone using JUnit or IDE tools, you can execute them inside a deployed application.

Author: Lara D’Abreo
Published: DevX, May 13, 2005
link

Continuous Integration & .NET (2): Continuous Integration and beyond…

05.14.2005 · Posted in Links

While unfamiliar to many developers, Continuous Integration is not a new concept at Microsoft, as is evident by Steve McConnell’s observation. Consequently, in this second installment of a two-part article, I examine the setup of a version-control system and configuration of a Continuous Integration tool that runs off of the version-control system in the .NET environment. I then integrate these tools into the build process to test for conformance with the Microsoft .NET Framework Design Guidelines, and finally address the issue of code-coverage testing.

Author: Thomas Beck
Published: Dr. Dobb’s Journal September, 2004
(Registration necessary)
link

Simplify Data Layer Unit Testing using Enterprise Services

05.14.2005 · Posted in Links

Despite all the hype surrounding unit testing and Test Driven Development (TDD) many developers don’t see them as useful processes that are applicable to the production of real-world applications. One reason is that once you get down to the intricacies of application development, all of the easy testing you’ve heard so much about can vanish. You may find yourself writing unit tests that are hard to implement against real code. This is often the case in database testing, where TDD can quickly lose its appeal, and force you to revert your processes to the previous real-world methodologies your team employed. Here, I’ll present some techniques to make your testing process easier, even when developing real-world applications, using unit testing.

Author: Roy Osherove
Published: MSDN Magazine, June 2005
link

Continuous Integration & .NET (1): Weaving together an open-source solution

05.14.2005 · Posted in Links

Several basic tools used to support Continuous Integration were ported to the .NET environment during the 1.0 release of the Framework. Other tools, such as CruiseControl and Clover, have been ported more recently. Furthermore, certain other tools such as NDoc are indigenous to .NET and only conceptually related to their Java counterparts (Java Doc, in this case). For the most part, articles written to date about these tools have addressed only a subset of the tools (usually NAnt and [url=http://www.testdriven.com/search.php?query=nunit&action=results]NUnit[/url]), thus failing to weave together a holistic Continuous Integration solution. Moreover, the unit-testing examples are function based and fail to address the database-driven reality of today’s enterprise applications.

In this two-part article, I introduce a complete Continuous Integration solution that encompasses automated builds, data-driven unit testing, documentation, version control, and code coverage.

Author: Thomas Beck
Published: Dr. Dobb’s Journal, August, 2004
(Registration necessary)
link