testdriven.com Wrangling quality out of chaos

Archive for May, 2004

Refactorings require new tests

05.31.2004 · Posted in Links

William C. Wake writes: "Refactoring [..] has a psychological side: a better design, but also a different design. A different design may induce people to act differently (indeed, that’s why we do it!). In particular, a different design may give people different expectations about code."
link

Tags:

Agile Handover

05.31.2004 · Posted in Links

Martin Fowler writes: "One of the most common questions I see about agile projects is how they deal with handover to another team. If you have a development team that leaves and hands over support to a support team, how do they cope when agile projects tend to produce much less documentation than plan-driven processes?"
link

Tags:

Testing shouldn’t be that hard

05.31.2004 · Posted in Links

Len Holgate writes: "I’ve been finding that since I’ve been using TDD and JITT I end up with many more classes than I used to have and each of them does less. Cohesion is up, coupling is down, functionality is split in a more orthogonal manner and the objects appear to be easier to reuse."
link

Tags:

CppTest: unit testing framework

05.31.2004 · Posted in Links

CppTest is a portable and powerful, yet simple, unit testing framework for handling automated tests in C++. The focus lies on usability and extendability.

Several output formats, including simple text output, compiler-like output and HTML, are supported and new ones are easily added.
link

The unit++ Testing Framework

05.31.2004 · Posted in Links

unit++ is a C++ unit testing framework similar to junit. It includes a C++ replacement for getopt that uses a command pattern to directly execute some code when the option is present, rather than just return the option.
link

Comparing jMock and Dynamock

05.31.2004 · Posted in Links

jMock was born as a fork of DynaMock, the dynamic mock object implementation from mockobjects.com. Initially we wanted to clean up the code, fix some omissions in the API and make an honest-to-goodness 1.0 release that guaranteed API stability. In the end we produced a significantly different API that encapsulates the lessons we have learned about unit testing with mock objects.

What are the main differences that a DynaMock user will notice when they start using jMock?
link

Tags:

jMock: Yoga for Your Unit Tests

05.31.2004 · Posted in Links

Brittle tests are a common "gotcha" of test driven development. A brittle unit test will stop passing when you make unrelated changes to your application code. A test suite that contains a lot of brittle tests will slow down development and inhibit refactoring. A brittle test overspecifies the behaviour of the unit being tested. You can keep your tests flexible by following a simple rule of thumb: specify exactly what you want to happen and no more.

This article describes how various features of jMock can help you strike the right balance between an accurate specification of a unit’s required behaviour and a flexible test that allows easy evolution of the code base.
link

Writing Code is not stupid

05.31.2004 · Posted in Links

Perryn Fowler writes: "Can we make the computer generate the implementation that makes the tests pass? Maybe. I can imagine for example something that took a Junit or perhaps even a FIT test and generated code to make it pass. I don’t imagine it would be easy, but I imagine it would be possible."
link

Tags:

Constraints in NUnit?

05.31.2004 · Posted in Links

Steve Freeman writes: "NUnit is progressing with version 2.2 in beta. It’s coming along nicely, but eventually I’d like to see them use the Constraint concept from the dynamic mock libraries, instead of simple equality."
link

Tags:

Nester: NUnit test tester

05.31.2004 · Posted in Links

Nester is a tool for mutation analysis of your source code in order to assess the adequacy of your tests. It involves modification of programs to see if existing tests can distinguish the original program from the modified program. Basically Nester is a .NET port of Jester slightly adjusted for C#.
link

JUnit Recipes e-chapters now available

05.28.2004 · Posted in News

The Early Access Program has begun for JUnit Recipes: Practical Programmer Testing Methods by J. B. Rainsberger. Visit www.manning.com/rainsberger to begin downloading chapters in *.pdf format.Book description from Manning.com:

"JUnit Recipes is a cookbook for building better Java applications. It contains 150 recipes for better code, using JUnit as both a testing tool and a design tool. Each recipe is a short, self-contained article that answers your questions about how to use JUnit, from taking your first steps all the way to testing complex J2EE applications, including servlets, JSPs, EJBs and JMS components.

If you want to use JUnit on a new project, this book tells you how to design easy-to-test applications, helping you avoid the design pitfalls of many legacy applications.

If you need to start testing an existing application, you will find recipes dedicated to testing even the most difficult-to-test legacy components, like EJBs and JDBC code.

The book also discusses many extensions to the JUnit framework, including JUnit-addons, HTMLUnit, XMLUnit, ServletUnit, DBUnit, JUnitX and EasyMock, choosing each to do the job it does best.

These recipes have been collected over the past several years from a variety of Java and J2EE projects, showing you what to do, how to do it, when to do it, and why. Test-Driven Design and Agile Software Development practitioners will recognize much of the book’s advice as following the principles of simple, flexible, supple design."

Pre-order this book at Amazon.

ClrUnit Beta

05.27.2004 · Posted in Tools

ClrUnit is a new unit testing framework for .NET.

It is similar in nature to NUnit, and provides several new features:

– A dynamic mock object library is included
– The concept of TestHosts are introduced, which allows you to do things such as declare that a test case needs to be run in its own application domain with a specific configuration file
– The concept of Test Groups and Filters is introduced, which allows for flexible test configurations.
– Tight integration with Visual Studio 2003 is included, including running and debugging unit tests within a single instance of Visual Studio.

You can find ClrUnit here.

-John Lewicki

TDD sessions at O’Reilly Open Source Convention

05.27.2004 · Posted in Events

The O’Reilly Open Source Convention, held July 26-30 in Portland, OR, will stage several sessions and tutorials on Test-Driven Development and related practices.Emerging Topics
Another Day of Extreme Programming
Monday, July 26, 8:45am – 5:15pm
This one day tutorial provides a hands-on introduction to Extreme Programming by playing out an accelerated example project. The main focus will be on developers, but team leaders and managers can participate as coaches and customers.

Java
DBUnit: Easier Database Testing
Wednesday, July 28, 4:30pm – 5:15pm
This presentation will walk you through inserting data into a clean database, updating an already modified database, and asserting both a straight JDBC SQL transaction and a Hibernate based Data Access Object properly interacted with the database. Additionally, we’ll demonstrate how easily you can use multiple databases, including Hypersonic SQL and MySQL without code changes.

Ruby
Controlling and Testing Distributed Systems with Ruby
Thursday, July 29, 10:45am – 11:30am
This presentation will examine ACME, a Ruby framework developed with the intent of controlling and testing the UltraLog system. [..] This presentation will show that Ruby excels as a language for testing systems, from the simplest to the most complex.

PHP
Unit Testing with PHPUnit
Thursday, July 29, 2:35pm – 3:20pm

Visit the O’Reilly Open Source Convention home page.

Rephlux: A Continuous Integration Tool for PHP

05.27.2004 · Posted in Tools

From [url=http://agilemovement.it/modules.php?op=modload&name=News&file=article&sid=493&mode=nested&order=0&thold=0]AgileMovement.it[/url]: "Rephlux is a PHP based tool for running a continuous testing/build process on your project and taking action based on the outcome of your tests. Rephlux is aimed at distributed developments and developments within larger teams."

Official website: http://rephlux.sourceforge.net/

Unit Testing Asynchronous Code

05.26.2004 · Posted in Links

Joe Walnes writes: "I try to avoid using code that instantiates threads from unit-tests. They’re awkward to write, brittle and I would rather extract the controlling thread, using the test as the controller. However there are times when it’s unavoidable."
link

Tags:

Test-Driven Development Sessions at XP Universe 2004

05.25.2004 · Posted in Events

The XP Universe 2004 conference, to be held August 15-18 in Calgary, Alberta, is a meeting place for developers on the leading edge of XP methodologies to share their insights.

Among other noteworthy tutorials and workshops, several sessions will directly address TDD and Acceptance testing practices:Tutorial: The Art of Acceptance Testing by Micah Martin
Tuesday, 1:30 pm – 5:00 pm in TBD
If you have never worked with Acceptance Tests (AT) before or struggled with them in the past then this tutorial will be great for you. We’ll cover a range of topics regarding ATs to familiarize everyone with the concept of ATs but most of the time in this tutorial will be spent actually writing ATs. Acceptance Testing is not a spectator sport so don’t expect to sit back and relax in this tutorial. We’ll learn the right way to write ATs: by writing them with FitNesse.

Tutorial: Advanced FIT Lab by Rick Mugridge
Wednesday, 8:30 am – 12:00 pm
This advanced tutorial explores in some depth the use of Fit in software development. Fit tables are for communicating what is needed from a system as well as for automatically checking that the system performs as expected. Tables need to clearly express such intent. Fit is very general purpose and open-ended, easy to extend with custom fixtures for expressing different sorts of tests.

Tutorial: Scripting Web Tests by Bret Pettichord, Brian Marick, Paul Rogers, Jonathan Kohl
Sunday, 1:30 pm – 5:00 pm in TBD
Learn how to write automated customer tests for web-based applications in this hands-on tutorial. We’ll show you how to use an open-source tool kit to create tests that drive a web browser. By the end of the tutorial, you’ll have written several tests for a sample application.

Tutorial: Agile Databases by Pramod Sadalage
Sunday, 1:30 pm – 5:00 pm in TBD
Presents a number of techniques to integrate the database world into the application world and provide a seamless way for developers, QA, analysts, client and dba’s to work in an iterative fashion so that the team can be more productive. These techniques include making database part of the Continuous Integration cycle, allowing everyone to have their own database.

Workshop: Who Should Write Acceptance Tests by Brian Marick, Christian Sepulveda, Rick Mugridge, David Hussman
Sunday, 8:30 am – 12:00 pm in TBD
Within Extreme Programming, the customer provides acceptance tests and the developers implement the system such that it satisfies the acceptance tests. There are frameworks such as FIT that are intended to empower the customer to write and execute acceptance tests.

Workshop: Agile Tests as Documentation by Brian Marick & Jonathan Kohl
Monday, 1:30 pm – 5:00 pm in TBD
Agile processes tend to minimize documentation. As the Agile Manifesto states, working software is preferred over comprehensive documentation. In the course of developing working software, tests are natural byproducts. What useful project documentation is already captured in these tests, and how do we leverage it? The concept of tests as documentation has been under-discussed in the community, and this workshop is an attempt to facilitate that discussion.

Go to XPUniverse.
View the full schedule.
Attend the conference as a volunteer.
See the archives of previous conferences (2001, 2002, 2003).

Mutation Testing with RAIL

05.25.2004 · Posted in Links

Jonathan de Halleux writes: "Mutation testing is the action of inserting ‘artificial’ faults into the Instance Under Test and look if the tests catch this fault. The idea is that the tests are adequate if they detect all the faults. For example, a typical mutation is to negate the condition expression in an ‘if’ statement."

See also: [url=http://www.testdriven.com/modules/mylinks/singlelink.php?cid=4&lid=166]Jester[/url], [url=http://www.testdriven.com/modules/mylinks/singlelink.php?cid=26&lid=405]Nester[/url]
link

Some answers on TDD

05.25.2004 · Posted in Links

Julian Bucknall writes: "A reader asked me a few questions about Test-Driven Development (TDD) and I thought them interesting enough that I decided to mold them and my answers into a blog article."
link

Tags:

Testing Private Methods with JUnit and SuiteRunner

05.25.2004 · Posted in Links

Whether you are using JUnit or SuiteRunner, you have the same four basic approaches to testing private methods: 1) don’t test private methods, 2) give the methods package access, 3) use a nested test class, and 4) use reflection.

The author discusses these four approaches to testing private methods in Java, and attempts to shed some light on when it makes sense to use each approach.

Author: Bill Venners
Published: Artima, May 24, 2004
link

A Mutation Testing Tool for Java Programs [PDF]

05.25.2004 · Posted in Links

High quality software can not be done without high quality testing. Mutation testing measures how "good" our tests are by inserting faults into the program under test. Each fault generates a new program, a mutant, that is slightly different from the original. The idea is that the tests are adequate if they detect all mutants.

Author: Mattias Bybro
Published: Master Thesis, Stockholm University 2003
link

Tags:

MockPP: Mock Objects for C++

05.25.2004 · Posted in Links

MockPP’s goal is to facilitate developing unit tests in C++, in the spirit of Mock Objects for Java, EasyMock and jMock.

[url=http://www.testdriven.com/search.php?query=mock&action=results]Mock objects[/url] allow you to set up predictable behaviour to help you test your production code by emulating some functionality your code depends on. This might for example be a huge database which is too difficult and time-consuming to maintain just for testing purposes.
link

WhichJUnit: JUnit-related classpath resolver

05.24.2004 · Posted in Links

A couple years ago I finally got tired of doing battle with the classpath. After all, it’s just like the PATH variable, and the Unix which utility was created as a weapon against pathing problems. Fueled by frustration, I created JWhich to help hunt down insidious classpath problems. After using it to my advantage in a few battles, I wrote an article explaining how it’s made my life with Java easier. I generally use it on the command line to check the system classpath, though some folks have adapted it for life inside of a servlet/EJB container. To address classpath problems specifically related to JUnit, WhichJUnit was born.

Developer: Mike Clark
link