testdriven.com Wrangling quality out of chaos

Posts Tagged ‘How-to’

Unit-testing with multiple cultures in MbUnit and NUnit

12.09.2004 · Posted in Links

It’s a good idea, when unit-testing your classes, to test under multiple circumstances — such as multiple cultures. Sure, a routine may work great when run under a given culture, say US English, but what if it is run on a Spanish or Japanese machine?

MbUnit makes it easy to run tests under different cultures. If NUnit is your tool of choice, you need to do a little bit more work.

Author: Roy Dictus
Blogged: December 6, 2004
link

PyFit (1): Writing FitNesse tests in Python

12.08.2004 · Posted in Links

Using the Python port of the FIT framework, this article shows how to write FitNesse acceptance tests and test fixtures. The examples should work just as well in any environment supported by FitNesse.

Author: Grig Gheorghiu
Published: November 2004
link

Unit Test More Efficiently with Mock Object Alternatives

12.08.2004 · Posted in Links

The mock-object testing pattern has commonly been used to test an individual unit of code without testing its dependencies. While this pattern works well for interaction-based testing, it can be overkill for state-based testing. Learn how to streamline your unit-testing using stubs and the pseudo-objects testing pattern.

Author: Javid Jamae
Published: DevX, December 1, 2004
link

NUnit Unit Testing of ASP.NET Pages, Base Classes, Controls and other widgetry using Cassini

12.05.2004 · Posted in Links

There’s a lot of info out there on how to cobble together NUnit Unit Testing of ASP.NET Pages and assorted goo. NUnitASP is a nice class library to facilitate this kind of testing, but it doesn’t solve a few problems:

- Do you have/want a Web Server on your Test/Build machine?
- How do you get your Test Pages and such over to the Web Server? Just automatically copy them?
- Are your Test cases self-contained? That is, do they require external files and other stuff to be carried along with them?

I have a need to test a number of utility classes, base classes for System.Web.UI.Page and other miscellany and I’d like the tests to be entirely self contained and runnable only with NUnit as a requirement.

So, here’s a small solution we use at Corillian. I use Cassini, the tiny ASP.NET Web Server that brokers HTTP Requests to System.Web.Hosting and the ASP.NET Page Renderer.

Author: Scott Hanselman
Published: November 30, 2004
link

Agile User Interface Development

11.19.2004 · Posted in Links

What is preventing people from building GUIs in an Agile way? Whether their application is web-based or a desktop application, most developers don’t do test-driven development (TDD) of the user interface. This is for a simple reason: unit testing GUI software is hard. Tests that exercise the GUI can be tedious and error-prone, involving complex code to simulate user events, wait while events propagate and controls redraw, and then attempt to check the state as it would appear to the user. Agility depends on doing TDD, but effective tests of specific behaviors are difficult to write for the GUI. The quality and design benefits of Agile have yet to be fully realized on the GUI side of the cube farm.

Author: Paul Hamill (author of Unit Test Frameworks)
Published: OnJava.com, November 17, 2004
link

Using Cargo for functional testing

11.19.2004 · Posted in Links

Automated tests are good. Automated Functional tests are even better as they are the proof that your application is working. In addition, with automated functional tests you can also automate your delivery process. However, writing automated functional tests is hard. The main reason it is hard is because you need to control your execution environment (database, application server, etc).

Cargo is a framework that you can use to automatically install, configure and execute J2EE containers. Thus it allows you to control your execution environment (for the J2EE container at least) and permits completely automated functional tests for J2EE applications.

Author: Vincent Massol
Published: November 17, 2004
link

Automate GUI tests for Swing applications

11.15.2004 · Posted in Links

Transition from unit tests to acceptance tests

Automation is necessary for frequent and consistent testing, which is the foundation of agile development. However, acceptance tests of GUI applications are not always easy to automate. This article explains a simple way of automating Java Swing application acceptance tests, starting from Swing components’ unit tests and extending them to acceptance tests without human intervention.

Author: Ichiro Suzuki
Published: JavaWorld, November 15, 2004
link

A lightweight nonintrusive EJB testing framework

11.15.2004 · Posted in Links

Bring your EJB 2.0 applications in line with testing best practices

This article presents a simple, easy-to-deploy framework that enables fine-grained tests to be run on the container, making it possible to develop and maintain Enterprise JavaBeans components using a test-driven development (TDD) process.

Author: Phil Zoio
Published: JavaWorld, November 15, 2004

link

Cruise Control Installed

11.15.2004 · Posted in Links

This document is meant to help you get running with CruiseControl 2.0 (CC). Starting from the download, it will take you through installing, configuring, and starting CC for the first time.

Author: Jonathan Julian
Published: Wiki, ongoing
link

More NUnit and Nant Tricks, Tips and Examples

11.15.2004 · Posted in Links

Nant (the .NET version of the Ant build tool) handles a wide range of build, deployment, and test tasks. Stewart Baird digs a little deeper into the .NET development tools Nant and NUnit, with tips and examples to help you with your next project.

Author: Stewart Baird
Published: InformIT, december 27, 2002
link

Practically Groovy: Unit test your Java code faster with Groovy

11.11.2004 · Posted in Links

Not long ago, developerWorks contributor Andrew Glover penned an article introducing Groovy, a new proposed standard language for the Java platform, as part of our alt.lang.jre series. Reader response was fantastic, so we’ve decided to launch this column to offer a practical guide to using this hot new technology. This first installment introduces a simple strategy for unit testing Java code with Groovy and JUnit.

Author: Andrew Glover, CTO, Vanward Technologies
Published: IBM DeveloperWorks, November 9, 2004
link

Continuous Database Integration (Revisited)

11.09.2004 · Posted in Links

The following article came about after reading reading Evolutionary Database Design by Martin Fowler and Pramod Sadalage. The concepts were great, but I couldn’t find anything on the web that really showed how to go about implementing it. So I decided to have a go at it myself from the ground up. Following is how I’ve managed to do it for the current project I’m working on.

Author: Peter Hancock
Published: November 7, 2004
link

Testing, 1, 2, 3… Testing… Check?

11.04.2004 · Posted in Links

All good programmers test their code. But can testing be easier? Can it be better? S. A. Miller shows how unit tests can help, along with an open source testing framework called TSQLUnit.

Author: S. A. Miller
Published: MSDN DeveloperWorks, 2004
link

Junit: Getting started with an example

11.04.2004 · Posted in Links

The goal of this article is getting started with Junit starting from a simple example.

Unit tests, integration tests and no regression tests take a large part in developer’s life. Junit is an open source test framework which is using by java developer’s community.

Author: Jean-Michel Garnier
Published: 2002
(via xyling)
link

Test Driven Development (3): Continuous Integration [PDF]

11.04.2004 · Posted in Links

In this final part of the three part series on Test Driven Development, we focus on continuous integration. When should we run our tests? How often should we run them? Where should the tests be run? Why are these questions important to ask and answer? In this article we address these issues and consider the tools that are available to realize these goals.

Author: Venkat Subramaniam
Published: AgileDeveloper, October 2004
See also: part 1, part 2
link

Test Driven Development (2): Mock Objects [PDF]

11.04.2004 · Posted in Links

In this second of the three part series on Test Driven Development, we focus on using Mock objects to isolate our code from its dependencies so as to make it testable and also to further development when the dependent components are not quite ready or available. In this article we discuss the benefits of Mock objects, show how to write one and finally present an example that uses the EasyMock framework.

Author: Venkat Subramaniam
Published: AgileDeveloper, September 2004
See also: part 1, part 3
link

Static Substitution: using Service Stubs for testing purposes

10.27.2004 · Posted in Links

As I listen to our development teams talk about their work, one common theme is their dislike of things held in statics. Typically we see common services or components held in static variables with static initializers. One of the big problems with statics (in most languages) is you can’t use polymorphism to substitute one implementation with another. This bits us a lot because we are great fans of testing – and to test well it’s important to be able to replace services with a Service Stub.

Author: Martin Fowler
Published: October 20, 2004
link

Deep Dive into Test Driven Development

10.27.2004 · Posted in Links

In a class I recently taught, the students created a simple payroll system using Test Driven Development. Different students made different amounts of progress, some almost finishing the example I’m about to post, and some not quite so far. But they all asked for my solution. I have already posted the code to my solution, but now I want to talk about how I went about creating it. Hopefully this will share my Test Driven thought processes with my students and anyone else who might be reading.

Author: Brian Button
Published: October 25, 2004
link

Driving on CruiseControl, part 2

10.23.2004 · Posted in Links

As we discussed in Part 1, there are some very good reasons for wanting to put your Continuous Integration builds’ results online for everyone to see. Many don’t like filling their inbox with full-blown reports, many projects don’t have easy access to a mail server, and many projects would like to integrate the build results to other dashboard-like applications which don’t quite fit in with the HTML email publisher solution.

In the case of CruiseControl, the web application used for presenting build results needs to work with the XML log files produced by CruiseControl during a build cycle. Not a surprise, the most used application used for exposing CruiseControl’s build results over the Web is the reporting application that comes as part of the CruiseControl distribution.

Author: Lasse Koksela
Published: JavaRanch, October 2004
link

Testing Multithreaded Code with Mock Objects

10.15.2004 · Posted in Links

A question that is frequently asked on the jMock users’ mailing list is "how do I use mock objects to test a class that spawns new threads"? The problem is that jMock appears to ignore unexpected calls if they are made on a different thread than that which runs the test itself. The mock object actually does throw an AssertionFailedError when it receives an unexpected call, but the error terminates the concurrent thread instead of the test runner’s thread.

Author: Nat Pryce
Published: October 14, 2004
link

Test Driven Development (1): TFC [PDF]

10.11.2004 · Posted in Links

In this first of the three part series on Test Driven Development, we focus on using NUnit to write our test cases and will illustrate the benefit of writing the test first, that is before writing the code. In Part II we will look at Mock objects and in Part III we will look at continuous integration.

Author: Venkat Subramaniam
Published: August 2004
See also: part 2, part 3
link

Build scripts with Groovy and Ant

10.04.2004 · Posted in Links

In nearly all developers’ toolboxes, Ant is the standard build tool for Java applications, thanks to its open, standard, and multiplatform structure. Though it represents a great improvement in automating production of complex J2EE applications, the choice of using XML syntax to express build automation has shown some limitations and drawbacks.

In this article, Filippo Diotalevi shows how to put together Ant and Groovy (the new JVM scripting language) to build a more flexible and powerful automation tool.

Author: Filippo Diotalevi
Published: JavaWorld, October 4, 2004
link