advertisement

O'Reilly Tags

We're experimenting with a folksonomy based on tag data provided by del.icio.us. Follow development in this blog post.


Mock Objects in Unit Tests (30 tags)
Unit testing your code against a service or process that's either too expensive (commercial databases) or just not done yet is something you can deal with by simulating the other piece with a mock object. EasyMock can suffice in some cases, but it can only create mock objects for interfaces. Mocquer, based on the Dunamis project, can create mocks for classes, too. Lu Jian shows how it works.

Perl Code Kata: Mocking Objects (8 tags)
One problem with many examples of writing test code is that they fake up a nice, perfect, self-contained world and proceed to test it as if real programs weren't occasionally messy. Real programs have to deal with external dependencies and work around odd failures, for example. How do you test that? In this Perl Code Kata, Stevan Little presents exercises in using Test::MockObject to make the messy real world more testable.

Perl Code Kata: Testing Databases (5 tags)
Testing simple code is all well and good, but what happens when your real code has to work with external programs, such as databases? How do you test your code adequately without going crazy writing scaffolding that has no chance of working anywhere but your test box? Stevan Little suggests that DBD::Mock can round out your test toolbox nicely in this Perl Test Kata.

Approaches to Mocking (3 tags)
Conceptually, you know what mock objects are, but practically speaking, how do you create and use them? Do you write mocks by hand or generate them automatically? Simon Stewart considers these possibilities and others, such as AOP-based mocking.