17.9. More Complex Tests (Multiple Test Scripts)
Initially, the h2xs program[*] gave us a single testing file, t/1.t. We can stick all our tests into this file, but it generally makes more sense to break the tests into logical groups in separate files.
The easiest way for us to add additional tests is to create t/2.t. That's itjust bump the 1 to a 2. We don't need to change anything in the Makefile.PL or in the test harness: the file is noticed and executed automatically.
We can keep adding files until we get to 9.t, but once we add 10.t, we might notice that it gets executed between 1.t and 2.t. Why? Because the tests are always executed in sorted order. This is a good thing because it lets us ensure that the most fundamental tests are executed before the more exotic tests simply by controlling the names.
Many people choose to rename the files to reflect a specific ordering and purpose by using names like 01-core.t, 02-basic.t, 03-advanced.t, 04-saving.t, and so on. The first two digits control the testing order, while the rest of the name gives a hint about the general area of testing.
As we saw earlier in Chapter 16, different module creation tools do different things and create one or more default tests. By default, Test::Harness runs those tests in the same order we just described.
Besides that, brian wrote Test::Manifest to get around this sort of naming scheme. Instead of letting the filenames dictate the order of tests, the file t/test_manifest does. Only the tests in that file run, and they run in the order we have them in the file. We name our test files after what they do rather than what order they should run. Later, when we want to insert new test files anywhere in the testing order, we just change the order in t/test_manifest.