[tpm] Follow-up on Feb 2012 Testing Talk

Olaf Alders olaf at vilerichard.com
Sat Mar 3 19:01:38 PST 2012


On 2012-03-03, at 10:18 AM, Rob Janes wrote:

> another thing is that if you're going to have a lot of tests, then it's a good idea to pad the numbers.  instead of 1, 2, 3 try 10, 20, 30.
> 
> I went a bit overboard here ...
> 
> 010-useability.t  023-compfile.t    031-uncompfile.t      040-memory.t         070-gzcomp.t
> 011-prototype.t   024-compfile.t    032-uncompfile.t      041-error.t          071-gzuncomp.t
> 020-compfile.t    025-compfile.t    033-uncompfile.t      050-deflate.t        080-version.t
> 021-compfile.t    026-compfile.t    034-uncompfile.t      051-deflate-flush.t  081-basic.t
> 022-compfile.t    030-uncompfile.t  035-uncompreadline.t  060-inflate.t        082-stream.t

One other way to approach this is to use numbered tests only when you need your tests to run in a certain order.  For example, the test suite for the MetaCPAN search site (a Catalyst app), looks like this:

[~/Documents/github/metacpan-web (master)] $ tree t
t
├── controller
│   ├── activity.t
│   ├── author.t
│   ├── diff.t
│   ├── feed.t
│   ├── home.t
│   ├── module.t
│   ├── raw.t
│   ├── recent.t
│   ├── release.t
│   ├── search
│   │   ├── autocomplete.t
│   │   └── precision.t
│   ├── search.t
│   ├── shared
│   │   └── release-info.t
│   └── source.t
└── encoding.t

The advantage here is that a) you don't need to worry about numbering at all and b) it becomes obvious what is being tested just by the hierarchy and naming of the files and folders.

Best,

Olaf


--
Olaf Alders
olaf at vilerichard.com

http://vilerichard.com -- folk rock
http://twitter.com/vilerichard
http://cdbaby.com/cd/vilerichard 






More information about the toronto-pm mailing list