SQLUnit User Guide | ||
---|---|---|
<<< Previous | User-Defined Test Grouping and Test Skipping | Next >>> |
CategoryHandler corresponds to <category> tag, nested in <classifiers> tag. As shown in the example of the previous section the body of <category> tag contains the category of the test. Now the user gives the global category in one of the following ways: as an ant property called sqlunit.category, as the value of the key sqlunit.category from SQLUnit's SymbolTable or as a System property called sqlunit.category. CategoryHandler will take the global category, the current test's category and will execute the test iff they match in the terms of regular expression matching. For example if the user invokes the test from the previous section with
ant -Dsqlunit.category=TestForModuleA |
the test will be executed. If it is invoked with
ant -Dsqlunit.category=TestForModuleB |
the test will not be executed.
Since <category> is an optional tag, the following edge cases are take into account: if the global category is not set all tests match regardless of their category; if a test does not have assigned category it matches regardless of the global category.
The global category can be given as regular expression pattern also:
ant -Dsqlunit.category=TestForModule(.*)
<<< Previous | Home | Next >>> |
SeverityHandler | Up | Extending SQLUnit: Write your own classification |