KXQTS::TestBaseLine Class Reference

Represents an expected test result for a test case. More...

#include <TestBaseLine.h>

List of all members.

Public Types

typedef QList< TestBaseLine * > List
enum  Type {
  XML, Fragment, Text, Ignore,
  Inspect, ExpectedError
}

Public Member Functions

QString details () const
void setDetails (const QString &details)
 TestBaseLine (const Type type)
void toXML (XMLWriter &receiver) const
Type type () const

Static Public Member Functions

static QString displayName (const Type id)
static Type identifierFromString (const QString &string)
static TestResult::Status scan (const QString &serialized, const TestBaseLine::List &lines)
static TestResult::Status scanErrors (const Patternist::Message::List &errors, const TestBaseLine::List &lines)

Protected Member Functions

TestResult::Status verify (const QString &serializedInput) const


Detailed Description

Represents an expected test result for a test case.

TestBaseLine represents a valid outcome for a test case, the "base line". A XQTS test case can have many different valid base lines, and one TestBaseLine instance represents on of them.

Of highest interest, TestBaseLine have the function scan() and scanErrors(), which allows serialized output to be compared to the base line.

Author:
Frans Englich <frans.englich@telia.com>

Definition at line 43 of file TestBaseLine.h.


Member Enumeration Documentation

enum KXQTS::TestBaseLine::Type

Identifies what kind of comparator to use. The documentation for each enumerator is copied from Guidelines for Running the XML Query Test Suite

Enumerator:
XML  The test harness must canonicalize both, the actual result and the expected result according to the "Canonical XML" recommendation [2], which refers to a number of open-source implementations. Byte-comparison can then be applied to the resulting XML documents. If the test harness does this process in a different manner, it must be documented.
Fragment  For XML fragments, the same root node must be created for both, implementation result and test suite result. The resulting XML can be compared using XML comparison.
Text  Text (that has been produced by XML serialization) is compared using byte-comparison.
Ignore  No comparison needs to be applied; the result is always true if the implementation successfully executes the test case.
Inspect  A human is required to make the call about correctness of the result according to the description in the test case.
ExpectedError  The expected result of the test case is an error, identified as an eight-character error code (e.g., XPST0003). The result of a test is true, if the implementation raises an error. However, raising an error because an implementation does not support the feature is not considered a correct result.

Definition at line 55 of file TestBaseLine.h.


Constructor & Destructor Documentation

KXQTS::TestBaseLine::TestBaseLine ( const Type  type  ) 

Constructs a TestBaseLine of type type.


Member Function Documentation

QString TestBaseLine::displayName ( const Type  id  )  [static]

Returns:
a display name for id. For example, if Inspect was passed, "Inspect" would be returned.

Definition at line 341 of file TestBaseLine.cpp.

References ExpectedError, Fragment, Ignore, Inspect, Text, and XML.

Referenced by toXML().

Here is the caller graph for this function:

TestResult::Status TestBaseLine::scan ( const QString &  serialized,
const TestBaseLine::List lines 
) [static]

Compares items(typically the result of an evaluation) against the base lines lines.

Returns:
the status of the first base line which passes, otherwise TestResult::Fail.

Definition at line 38 of file TestBaseLine.cpp.

References KXQTS::TestResult::Fail, KXQTS::TestResult::NotTested, and KXQTS::TestResult::Pass.

void TestBaseLine::setDetails ( const QString &  details  ) 

What details contains depends on the type(). If the type() is ExpectedError, details contains the relevant error code. If the type() is one which compares result against a base line, it is a filename locating the baseline.

Definition at line 394 of file TestBaseLine.cpp.

Referenced by KXQTS::TestSuiteHandler::endElement().

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
Generated on Thu Feb 8 14:54:31 2007 for Patternist by  doxygen 1.5.1