Wiki: All Files

# All Files

This is the first of a suite of fixtures that make up the AllPairsExample. It and AllCombinations are warmups for AllPairs testing.

A project can expect to have dozens to hundreds of files filled with specifications, explainations and associated tests. The AllFiles fixture seeks out these files and runs them all, one after another, and reports a "rolled-up" accounting of their results.

Like the ExampleTests fixture, the AllFiles fixture will take as its tabular input a list of files to be run. But here, unlike that fixture, we will expand wildcard characters in order to find all the tests in a particular place, whether we know what they are now or not.

Here are wildcard path expressions that find lots of other tests. Try runing them with http:run.cgi.

eg.AllFiles
input/*Example.html |
CalculatorExample.html | 75 right, 8 wrong, 0 ignores, 1 exceptions[!]
MusicExample.html | 91 right, 4 wrong, 0 ignores, 0 exceptions[!]
NetworkExample.html | 4 right, 0 wrong, 0 ignores, 3 exceptions[!]
WebPageExample.html | 15 right, 5 wrong, 0 ignores, 0 exceptions[!]
input/Music*.html |
MusicExample.html | 75 right, 24 wrong, 0 ignores, 0 exceptions[!]
MusicExampleWithErrors.html | 40 right, 46 wrong, 80 ignores, 0 exceptions[!]

The AllFiles fixture adds rows to this table for each of the files it finds. The first column is the expanded file name, the second, the resulting counts for that run. We mark the results "wrong" if there are any wrongs or exceptions. That means the above tests will never pass because we have intentional errors in these files.

Use AllFiles when you expect all your tests to pass and only want to know when this expectation is unfounded. AllFiles does not create output files for the tests it runs unless there is a problem. Problem run results are saved and cited along with the counts in a FileFootnote that looks like [1], [2], and so on.

Test counts can sore when we start running files over and over. LessonsLearned advise us to not take big "right" counts too seriously so we don't. In fact a file with 100 right and no wrong counts as 1 right from this fixtures perspective. You can see this in the counts reported in the summary:

fit.Summary
counts | 0 right, 6 wrong, 0 ignores, 0 exceptions
input file | input/AllFiles.html
input update | Sat Apr 29 01:00:06 2006
output file | output/AllFiles.html
run date | Wed May 3 18:10:01 2006
run elapsed time | 0 wallclock secs ( 0.07 usr + 0.00 sys = 0.07 CPU)

(Note: See more complete summary below.)

You will also note that the fixture reports total counts for the files it runs under counts run in the summary because, lessons not withstanding, we like to know.

Implementation

The fixture distinguishes expandings the path specifications (doRow) from running the list of files produced (doFiles). This fixture does the files as they are expanded. The AllCombinations and AllPairs refinements expand all rows before they start doing.

The path expansion only expands one wildcard character, star (*), which means any characters here. The star can appear anywhere in a name and in any or all names that make up a path. But the expansion we've coded has the restriction that only one star is expanded in any component of the path.

The expanded file names will refer to files that may or may not use the <wiki> tag convention (See WikiRunner). This fixture is happy to run either file format and lets the presence of a <wiki> tag in the file indicate the need for its processing.

See the source.

- http:Release/Source/eg/AllFiles.java

This class includes an implementation of FileFootnote that is discussed on that page.

eg.AllFilesExpand
path | expansion()
input/*Example.html | CalculatorExample.html,MusicExample.html,NetworkExample.html,WebPageExample.html
input/Music*.html | MusicExample.html,MusicExampleWithErrors.html
input/AllPairs/magnitude/*.html | 180+30.html,30.html,360+30.html,90-30.html
input/AllPairs/sign/*.html | change-sign.html,multiply.html,no-change.html
input/AllPairs/function/*.html | cosine.html,sine.html
input/AllPairs/function/*sine.html | cosine.html,sine.html
input/AllPairs/function/*.xml |
input/AllPairs/func* |
input/AllPairs/* |
input/AllPairs* | AllPairs.html,AllPairs.html.orig
input/* | AllCombinations.html,AllCombinations.html.orig,AllFiles.html,AllFiles.html.orig,AllPairs.html,AllPairs.html.orig,arithmetic.html,BasicEmployeeCompensation.html,BinaryChop.html,CalculatorExample.html,ExampleTests.html,FitAcceptanceTests.html,logo.gif,MusicExample.html,MusicExampleWithErrors.html,MusicExampleWithErrors.html.orig,NetworkExample.html,WebPageExample.html,WebPageExample.html.orig

We've added some more tests to this document so the totals in the summary increase.

fit.Summary
counts | 6 right, 6 wrong, 0 ignores, 0 exceptions
input file | input/AllFiles.html
input update | Sat Apr 29 01:00:06 2006
output file | output/AllFiles.html
run date | Wed May 3 18:10:01 2006
run elapsed time | 0 wallclock secs ( 0.08 usr + 0.01 sys = 0.09 CPU)

Last edited April 20, 2003