Declaring the group of a test

All the grouping information of a given test is declared in <classifiers> tag. It is called in this way, because it classfies the test. One concrete example is:


  <test name="testName">
    <classifiers>
      <severity>WARN</severity>
      <category>TestForModuleA</category>
    </classifiers>
    <sql>
      <stmt>aSimpleResult>/stmt>
    </sql>
    <result>
      <resultset id="1"gt;
        <row id="1">
          <col id="1" name="col1" type="INTEGER">1</col>
        </row>
      </resultset>
    </result>
  </test>
      

This means that this test belongs to TestForModuleA category and its severity is WARN, so that if it fails it will be just a warning and not a error or a fatal situation.

The user then should provide some global criteria and each test's classification will be compared. If the test matches them it will be executed; if not will be skipped and reported as skipped. Here is a detailed explantion how the decision whether a test matches ot not is done. When <classifiers> tag is reached, its corresponding ClassifiersHandler is called, whose in turn calls the handlers of all its children. It is responsibility of the children's handler to extract the criterion they are interested in from the environment and then to compare whether their content meets that criterion. If it is not met they return false (as a Boolean object) to ClassifiersHandler. On the other hand, the latter stops its execution on the first false value it receives and the test is not executed.

For a concrete example how the user defines these global criteria see the next two sections.

SQLUnit comes with two classifying handlers (but you can provide your own too), which are SeverityHandler and CategoryHandler and the next two sections are dedicated to them.