4: Test file generation

The purpose of Test file generation is to automatically generate files after the generation logic is defined.

 

Introduction

Purpose of Test file generation is to automatically generate files after the generation logic is defined. Test files are generated based on user-written actions language, which means generation of test-files is efficient and creation of large and multiple test files is fairly straightforward. 

Creation is based on template file which then gets modified by an action. As a result multiple variations of original template file gets generated.

Main functionalities of test file generation in Studio

Test file generation in Studio and the available tabs is shown below. The default tab when Test file generation is opened is Actions.

Actions

Actions contain list of actions made for the project. Each row shown in actions tab depicts one test file to be generated (unless save method is used within action).

Functions

Functions tab contain the functions made for the project. Functions can be called within actions and can take in parameters and return data back to actions.

Seed data

Seed data tab lists the seed data made for the project. Seed data is inserted and shown in .CSV format. This data can be called from actions and from validation rules. 

Template

Template shows the template file used for the project. Template file is used as a target file where all actions are ran.

Creating test files with actions and template file 

Existing actions are seen and new actions are created in the actions tab. 

User interface

 

The purpose of columns can be seen from the table below.

Column Purpose
R (Rule) Tells if this actions is attached to a validation rule or not.
P (Public) Tells if the file generated by this actions is published in validation service as an example file.
Expected result Whether test file which is generated is expected to be valid or invalid.
Name Name of action and ensuing XML-file.
Action Actions definition which will be executed to generate the actual test file.
Context Complex or SimpleType against which the actions language is executed.
Description Description of the test file, free text field.

 

Creating a test file with actions

Right-hand side of the actions tab contains a button "Add new action" which adds a new row to the actions list. Action information is filled to newly created row.

 

 

As actions are ran against XML-file, template file has to be included before test files can be generaed. Template file is added from the tab Template and may be given as a XML-file or pasted in the free text field.

Usage of functions

Functions can be used within actions to execute specific actions code or to return data to action calling it. Similarly to adding action, new function may be added by selecting Add new function from the right-hand side of the screen. 

 

New function content is added in an opened modal

 

Purpose of each field is listed below.

Column Purpose
Name Name of function. Function is called by using this name
Description Description of function. Free text field
Returns Type returned by function. Accepts types defined in schema as well as schema built-in types
Parameters Parameters given to the function when calling it. Multiple parameters supported
Function Actions code executed when function is called

 

 

Usage of seed data

Seed data is inserted and shown in .CSV format in the Seed data tab. This data can be called from actions and from validation rules. New seed data can be inserted from the button "Add new seed data".