Zum Inhalt

QTK.Common

The assembly QTK.Common.dll contains generic purpose functions and tests.

CsvRecordsetSelector

Stupka.QTK.Common.CsvRecordsetSelector (QTK.Common.dll)

Selects a two-dimensional recordset based on a csv file. Recordsets can either be used for testing the content of the file itself, or might be used as input for other tests or actions to provide detailed instructions.

Properties

Name Type Required Description
filter xsd:IDREF Reference to a recorset which is used to pre-filter the data. The filter recordset has to provide two columns column and text, the specified text is expected exactly in the corresponding column.
resource xsd:string Yes Reference to a resource which contains the data.

ManualAction

Stupka.QTK.Common.ManualAction (QTK.Common.dll)

Shows a message, asking the user to perform a specific action manually.

Properties

Name Type Required Description
text xsd:string Message which will be shown to the user.

ManualTest

Stupka.QTK.Common.ManualTest (QTK.Common.dll)

Shows a message, asking the user to perform a specific test manually and state if the test passed or failed.

Properties

Name Type Required Description
text xsd:string Message which will be shown to the user.

RecordsetCompareTest

Stupka.QTK.Common.RecordsetCompareTest (QTK.Common.dll)

Checks if the content of a candidate recordset matches a reference recordset. The test checks if the record exists based on a row key, and additionally tests all data columns for equality.

Properties

Name Type Required Description
exact xsd:boolean
keycolumnname xsd:string Yes Name of the column which holds the row key within the reference recordset. The key column name can be mapped to a different column in the candidate using Mapping.
mapping xsd:IDREF Reference to a selector, which provides the recordset used for column name mapping between Reference and Candidate (not all column names have to be mapped).
recordset xsd:IDREF Yes Reference to a selector which provides the candidate recordset.
reference xsd:IDREF Yes Reference to a selector which provides the reference recordset.

Errorcodes

Value Errorcode Description
1 SomeRecordsContainWrongData All records exist, but some cells contain wrong data.
2 AllRecordsContainWrongData All records exist, but all cells contain wrong data.
3 SomeRecordsDoNotExist Some records do not exist.
4 AllRecordsDoNotExist All records do not exist.

Usage

For this test a Mapping can be specified, if Candidate has different column names as the reference recordset.

Column Description
Reference Column name within Reference
Candidate Column name within Candidate

The example below shows an extract from data and a script.

data.xml

<Recordsets>
  <Recordset id="reference">
    <Rows>
      <Row name="row1" col1="A1" col2="A2" col3="A3" />
      <Row name="row2" col1="B1" col2="B2" col3="B3" />
      <Row name="row3" col1="C1" col2="C2" col3="C3" />
    </Rows>
  </Recordset>
  <Recordset id="mapping">
    <Rows>
      <Row reference="name" candidate="identifier" />
      <Row reference="col1" candidate="data1" />
      <Row reference="col2" candidate="data2" />
      <Row reference="col3" candidate="data3" />
    </Rows>
  </Recordset>
  <Recordset id="candidate">
    <Rows>
      <Row identifier="row1" data1="A1" data2="A2" data3="A3" data4="A4" />
      <Row identifier="row2" data1="B1" data2="B2" data3="B3" data4="B4" />
      <Row identifier="row3" data1="C1" data2="C2" data3="C3" data4="C4" />
      <Row identifier="row4" data1="D1" data2="D2" data3="D3" data4="D4" />
    </Rows>
  </Recordset>
<Recordsets>

script.xml

<Script xmlns="http://www.stupka.at/qtk" comment="..." identifier="...">
  <Resources>
    <Resource identifier="xmldata" location="..." name="data.xml"/>
  </Resources>
  <Positions>
    <Group comment="Recordset selection">
      <Common.XmlRecordsetSelector identifier="reference" resource="xmldata" xpath="//Recordset[@id='reference']/Rows/Row"/>
      <Common.XmlRecordsetSelector identifier="candidate" resource="xmldata" xpath="//Recordset[@id='candidate']/Rows/Row"/>
      <Common.XmlRecordsetSelector identifier="mapping" resource="xmldata" xpath="//Recordset[@id='mapping']/Rows/Row"/>
    </Group>
    <Group comment="Comparison">
      <Common.RecordsetCompareTest reference="reference" candidate="candidate" mapping="mapping" keycolumnname="name"/>
    </Group>
  </Positions>
</Script>

RecordsetContentTest

Stupka.QTK.Common.RecordsetContentTest (QTK.Common.dll)

Checks if a recordset contains a specific record, identified by a row key. Additionally, the value of a specified column can be checked.

Info

The recordset can be loaded from the file system (xml or csv), or can be created by other selectors which result in a recordset.

Properties

Name Type Required Description
columnname xsd:string Name of the column which holds the data.
columntext xsd:string Value which is expected at the specified position.
keycolumnname xsd:string Yes Name of the column which holds the row key.
recordset xsd:IDREF Yes Reference to a selector, which provides a recordset.
rowkey xsd:string Yes Row key which will be searched in the specified key column.

Errorcodes

Value Errorcode Description
1 RecordExistsButDataDoesNotMatch The record has been found, but the text does not match.
2 RecordDoesNotExist The record does not exist at all.

Usage

data.xml

<Recordsets>
  <Recordset id="identifier">
    <Rows>
      <Row Col1="value1.1" Col2="value1.2" Col3="value1.3"/>
      <Row Col1="value2.1" Col2="value2.2" Col3="value2.3"/>
      <Row Col1="value3.1" Col2="value3.2" Col3="value3.3"/>
    </Rows>
  </Recordset>
</Recordsets>

script.xml

<Script xmlns="http://www.stupka.at/qtk">
  <Resources>
    <Resource identifier="data" location="path\to\file" name="data.xml"/>
  </Resources>
  <Positions>
    <Group comment="Init">
      <Common.XmlRecordsetSelector identifier="candidate" xpath="//Recordset[@id='identifier']/Rows/Row" resource="data"/>
      <Common.RecordsetContentTest records="candidate" keycolumnname="col1" rowkey="value2.1" columname="col2" columntext="value2.2"/>
    </Group>
  </Positions>
</Script>

RecordsetExportExecutor

Stupka.QTK.Common.RecordsetExportExecutor (QTK.Common.dll)

Dumps a recordset to a xml file.

Properties

Name Type Required Description
filename xsd:string Yes Absolute or relative filename of the export file.
recordset xsd:IDREF Yes Reference to a selector, which provides a recordset.

RecordsetRowCountTest

Stupka.QTK.Common.RecordsetRowCountTest (QTK.Common.dll)

Properties

Name Type Required Description
recordset xsd:IDREF Yes
rowcount xsd:integer Yes

ScriptInformationExecutor

Stupka.QTK.Common.ScriptInformationExecutor (QTK.Common.dll)

Properties

Name Type Required Description
scriptinformation xsd:IDREF Yes

Waiter

Stupka.QTK.Common.Waiter (QTK.Common.dll)

Waits a number of seconds.

Properties

Name Type Required Description
time xsd:integer Yes Time to wait in seconds.

XmlRecordsetSelector

Stupka.QTK.Common.XmlRecordsetSelector (QTK.Common.dll)

Selects a two-dimensional recordset based on a xml file. Recordsets can either be used for testing the content of a file itself, or might be used as input for other tests or actions to provide detailed instructions.

Info

As XML is a flexible file format and does not define any structure, a xpath expression is used to select the needed data from the file. The column names of the recordset are created based on the available attribute names, the values itself have to be specified as attributes.

Properties

Name Type Required Description
filter xsd:IDREF Reference to a recorset which is used to pre-filter the data. The filter recordset has to provide two columns column and text, the specified text is expected exactly in the corresponding column.
resource xsd:string Yes Reference to a resource which contains the data.
xpath xsd:string Yes XPath expression for data selection.

Usage

file.xml

<Recordsets>
  <Recordset id="identifer">
    <Rows>
      <Row Col1="value1.1" Col2="value1.2" Col3="value1.3"/>
      <Row Col1="value2.1" Col2="value2.2" Col3="value2.3"/>
      <Row Col1="value3.1" Col2="value3.2" Col3="value3.3"/>
    </Rows>
  </Recordset>
</Recordsets>

script.xml

<Script xmlns="http://www.stupka.at/qtk" identifier="..." comment="...">
  <Resources>
    <Resource identifier="data" location="path\to\file" name="file.xml"/>
  </Resources>
  <Positions>
    <Group comment="Init">
      <Common.XmlRecordsetSelector host="local" identifier="def" xpath="//Recordset[@id='identifer']/Rows/Row" resource="data"/>
    </Group>
  </Positions>
</Script>

Letztes Update: 26. November 2020