I have a bunch of perl tests:
- Functional Tests
- Mechanize Tests
- Actual Unit Tests, asserting on functions and return values, etc
- Tests that involve external Services, like WebServices
- DB centric tests
- REST tests
I run all of them via prove and theoretically re-arrange them into various directories and run something like find t/ -name '*.t' ! -name '*timeout*' | xargs prove -l
, but gets very difficult (and not good engineering) to name tests a particular way, so we can parse them via find
.
Is there a way we can pass a wildcard list of tests to prove
when we run it via command line?
If not, is there a more sane approach than what we're currently using?
The usual way to to this is via environment variables. The test file checks whether it's supposed to run, and if it's not does a quick
skip_all
.For example:
Now usually that test will be skipped. But if you set the
EXTENDED_TESTING
environment variable to"1"
, it will run.Standard environment variables include
EXTENDED_TESTING
,RELEASE_TESTING
, andNONINTERACTIVE_TESTING
.NO_NETWORK_TESTING
is also catching on.There are various modules to automate this such as Test::Is which allows the simpler syntax:
If you have some other application-specific categories, you'll have to invent some environment variables yourself. If you think they seem generically useful, blog about them, and maybe they'll catch on and become standard environment variables too.