Skip to content

How to define test data?

iks github user edited this page Jun 21, 2019 · 21 revisions

Back to User Guide Main Page


There are four options to define test data. Two of those options are using an import mechanism, the two others define test data within the nlxx file.

a) Hardcoded test data

Hardcoded means that data values are embedded in the instruction line, e.g.

Enter in field "Name" the value "James Bond". 

To hardcode field names is a good thing to do, but to hardcode the actual test data does not allow to execute the current XX with different test data.

b) In-file-embedded test datasets

With the stage instruction "TestData" in the XX definition's header you may define any number of datasets within the nlxx file. This is done by providing a data table in the following format:

TestData:
|name|age|gender|
|Lisa|20 |female|
|Bob |19 |male|

c) In-file-embedded single data values

With the instruction stage instruction "TestData" it is also possible define single test data values. If the key of such an single value definition has been previously defined and therefore is already known, the second declaration overwrites the first one. If not, SysNat adds this value to its automatically created default dataset.

TestData: name=Lisa
TestData: age=20

d) Imported test data from dat-files

Test data that SysNat has to read from external dat-files must be defines by the stage instruction TestData. This can be done in one or more declaration(s):

TestData: OrderData1, StandardMember 
TestData: Address2 and StandardBankAccount

Each value defined in the TestData declarations is supposed to represent a file located in the folder *sysnat.natural.language.executable.examples/testdata/ or one of its subdirectories. Data files with the extension *.dat' are supposed to represent plain text and to contain data as key/value pairs, e.g.

name=Lisa
age=20
gender=female
-
name=Bob
age=19 
gender=male

Datasets are separated by a "-" line.

e) Imported test data from Excel-files

The import of Excel data works basically the same as for dat-files. However, some additional information exist about Importing Excel Data.


Previous | Next

Clone this wiki locally