KXQTS::TestCase Class Reference

A generic abstract base class for test cases. More...

#include <TestCase.h>

Inheritance diagram for KXQTS::TestCase:

Inheritance graph
[legend]
Collaboration diagram for KXQTS::TestCase:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Scenario {
  Standard = 1, ParseError = 2, RuntimeError = 4, Trivial = 8,
  AnyError = RuntimeError | ParseError
}

Public Member Functions

virtual void appendChild (TreeItem *)
virtual TestBaseLine::List baseLines () const=0
virtual TreeItemchild (const unsigned int) const
virtual unsigned int childCount () const
virtual TreeItem::List children () const
virtual QString creator () const=0
virtual QString description () const=0
virtual TestResult::List execute (const ExecutionMode mode, const ExecutionStage stage, TestSuite *ts)
virtual Patternist::ExternalVariableLoader::Ptr externalVariableLoader () const=0
virtual bool isFinalNode () const
virtual bool isXPath () const=0
virtual QDate lastModified () const=0
virtual QString name () const=0
virtual ResultSummary resultSummary () const
virtual Scenario scenario () const=0
virtual QString sourceCode (bool &ok) const=0
 TestCase ()
virtual QUrl testCasePath () const=0
virtual TestResulttestResult () const
virtual QString title () const=0
void toXML (XMLWriter &receiver) const
virtual ~TestCase ()

Static Public Member Functions

static QString displayName (const Scenario scen)
static Scenario scenarioFromString (const QString &string)

Detailed Description

A generic abstract base class for test cases.

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

Definition at line 40 of file TestCase.h.


Member Enumeration Documentation

enum KXQTS::TestCase::Scenario

Corresponds to the simpleType test:scenarios-enum

Enumerator:
Standard  The test case should evaluate normally and that the output should match the supplied base line.
ParseError  The test case should result in a static error, a parser error.
RuntimeError  The test case should result in a dynamic error, a runtime error.
AnyError  ParseError and RuntimeError OR'd.

Definition at line 46 of file TestCase.h.


Member Function Documentation

void TestCase::appendChild ( TreeItem  )  [virtual]

Calling this function makes no sense, so it always performs an Q_ASSERT check.

Implements KXQTS::TreeItem.

Definition at line 503 of file TestCase.cpp.

virtual TestBaseLine::List KXQTS::TestCase::baseLines (  )  const [pure virtual]

Returns:
the valid test baselines for this test case. If only one outcome is valid, the returned list only contains that baseline.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by toXML().

Here is the caller graph for this function:

TreeItem * TestCase::child ( const unsigned  int  )  const [virtual]

Calling this function makes no sense, so it always performs an Q_ASSERT check.

Implements KXQTS::TreeItem.

Definition at line 508 of file TestCase.cpp.

unsigned int TestCase::childCount (  )  const [virtual]

Returns:
always zero

Implements KXQTS::TreeItem.

Definition at line 519 of file TestCase.cpp.

TreeItem::List TestCase::children (  )  const [virtual]

Returns:
always an empty list.

Implements KXQTS::TreeItem.

Definition at line 514 of file TestCase.cpp.

virtual QString KXQTS::TestCase::creator (  )  const [pure virtual]

The full name of the creator of the test case. For example, "Frans Englich".

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by KXQTS::TestCaseView::displayTestCase(), and toXML().

Here is the caller graph for this function:

virtual QString KXQTS::TestCase::description (  )  const [pure virtual]

A description of the test case for human consumption.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by KXQTS::TestCaseView::displayTestCase(), and toXML().

Here is the caller graph for this function:

TestResult::List TestCase::execute ( const ExecutionMode  mode,
const ExecutionStage  stage,
TestSuite ts 
) [virtual]

Executes the test, and returns the result. The returned list will always contain exactly one TestResult.

stage is ignored when running out-of-process.

Implements KXQTS::TestItem.

Definition at line 57 of file TestCase.cpp.

References KXQTS::TestItem::InProcess, name(), KXQTS::TestItem::OutOfProcess, and KXQTS::TestItem::RunFailsafe.

Here is the call graph for this function:

bool TestCase::isFinalNode (  )  const [virtual]

Returns:
always true

Implements KXQTS::TestItem.

Definition at line 529 of file TestCase.cpp.

virtual bool KXQTS::TestCase::isXPath (  )  const [pure virtual]

Whether this test case only make use of XPath features.

Returns:
false if the test case exercises any XQuery feature which is not available in XPath 2.0.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by KXQTS::TestCaseView::displayTestCase(), and toXML().

Here is the caller graph for this function:

virtual QDate KXQTS::TestCase::lastModified (  )  const [pure virtual]

The date of when the test case was created or last modified.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by KXQTS::TestCaseView::displayTestCase().

virtual QString KXQTS::TestCase::name (  )  const [pure virtual]

The test case's identifier. For example, "Literals001".

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by execute(), and toXML().

Here is the caller graph for this function:

TestItem::ResultSummary TestCase::resultSummary (  )  const [virtual]

Returns:
a ResultSummary for this TestItem.

Implements KXQTS::TestItem.

Definition at line 494 of file TestCase.cpp.

References KXQTS::TestResult::Pass.

virtual Scenario KXQTS::TestCase::scenario (  )  const [pure virtual]

What kind of test this is. For example, whether the test case should result in a parser error or should evaluate without errors.

The vast common case is that one Scenario is returned; the bit signifiance is for the TestCase sub-class UserTestCase.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by KXQTS::TestCaseView::displayTestCase(), and toXML().

Here is the caller graph for this function:

TestCase::Scenario TestCase::scenarioFromString ( const QString &  string  )  [static]

Determines the corresponding Scenario enumerator from the string representation string.

The following mappings are in effect:

Definition at line 384 of file TestCase.cpp.

References ParseError, RuntimeError, and Standard.

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

Here is the caller graph for this function:

virtual QString KXQTS::TestCase::sourceCode ( bool &  ok  )  const [pure virtual]

The test's source code. That is, the XPath/XQuery code for the test.

Parameters:
ok the function sets this value to false if loading the query failed, and returns a description of the error for human consumption. If everything went ok, ok is set to true, and the query is returned.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by KXQTS::TestCaseView::displayTestCase().

virtual QUrl KXQTS::TestCase::testCasePath (  )  const [pure virtual]

The path to the file containing the code of the test case.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by toXML().

Here is the caller graph for this function:

virtual QString KXQTS::TestCase::title (  )  const [pure virtual]

The title of the test. This can be the identifier of the test, for example.

Implemented in KXQTS::XQTSTestCase, and KXQTS::UserTestCase.

Referenced by KXQTS::TestCaseView::displayTestCase().


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