| XML Repository |
Configuration of the XML RepositoryThe description of the tests, the constitution of test scenarios as well as the supply of parameters for the test units is done separatly from the actual test implementation through a repository. This must implement certain interfaces of the framework to supply the necessary information during the test run. The default repository of the iValidator is the xml-repository for the test descriptions (Descriptor Repository). Other repositories (e.g. database) can be implemented. Further information will be subject of the developers guide. This guide explains how to describe test scenarios using the XML Repository.
Configuration for the XML Descriptor RepositoryTo start a test run with an xml repository the following entries must be made in the test configuration file. <descriptor repository="xml"> <property name="inputpath" value="input"/> <property name="input" value="testsuite_simple.xml"/> <property name="classpath" value="classes"/> </descriptor> The repository attribute denominates the repository type as xml. The xml descriptor repository expects the following properties:
The xml repository processes a test description in xml format. This special input file for the xml repository will be refered to XML-Descriptor-Repository according to the name of the root element for the remainder of this document. Configuration of the XML Report RepositoryTo store the reports of a test run in xml format the following must be defined in the configuration file: <report repository="xml"> The repository attribute defines the repository type xml. The xml report repository expects the following properties:
The xml repository creates a report file in xml format. This special output format will be refered to as XML-Report-Repository for the remainder of this document. The XML-Descriptor-Repository <descriptor-repository>The structure of the xml descriptor repository is defined with a W3C Schema xml-repository.xsd. The root element is the <descriptor-repository>. Then the following elements may occur optionally and in any order: The Test Descriptor: <test>The xml descriptor repository does not explicitly distinguish test suites and test units. Both are described within the <test> element. The <test> elements may be nested unlimited to build the test hierarchy.
Description of a test unitTest units contain either an alias attribut as a reference to the unitlib or an instance element.
Examples: <test name="myTestUnit"> The instance of the test unit is defined with the instance element. Better practice is the definition in the unit lib to separate the implementation details from the description of the test hierarchie and thus get a higher reusablity. <test alias="loginTest"/> The test unit is defined in the unit lib of the repository. <test name="myLoginTest" alias="LoginTest"/> The test unit is defined in the unit lib of the repository. During the test run it will be named differently. Description of a test suiteTest suites contain at least one flow element. Additionally setups, teardowns and checkups can be specified. The flow element may contain any number of test elements each of which can be a suite or unit. Like that a test hierarchy of unlimited depth (theoretical) can be constructed.
Example for import: main-repository.xml:
The <parameters> elementThere are 2 alternatives for the specification of parameters, namely plain parameters as name/value pairs and parameterlists. The parameters can be specified explicitly with the unit or test definitions or within the parameter lib as parametergroups that can be referenced by an alias. Within the <parameters> element the elements <parameter>, <parameterlist> and <parametergroup> may occur in any order.
It's a basic setting of the iValidator framework in which order the parameters in the test hierarchy take precedence. The setting is made in the configuration file. <property name="ivalidator.parentparamsfirst" value="true"/> parentparamsfirst="true" means that the parameters of any parent test suite overwrite those defined in unterlying tests.
Example: <parameters> The <flow> elementThe flow element contains all the tests of the suite.
The 2 following control types are available at the moment: 1. process control <control type="flowexecution" value="[parallel | sequential]"/> By default tests within a flow are processed sequentially. 2. result control <control type="result" The defaults are described in the unit implementation guide.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Attribute | m/o | Description |
| name | o | The name attribute defines the name of the setup, checkup or teardown. If no alias attribute is defined, name attribute and instance element are mandatory. |
| alias | o | The alias attribute reference a unit in the unitlib. The alias corresponds to the unique name of the unit in the unitlib. If the setup, checkup or teardown has no name attribute the name of the unit is used. If no alias attribute is defined, name attribute and instance element are mandatory. |
| Element | m/o | Description |
| parameters | o | Same as the parameters for the test units. |
| instance | o | May be used to define the implementation of the unit wit a class and a method name. Better practice is to use the alias. |
Example:
<setups>
<setup alias="setup1InUnitlib">
<parameters>...</parameters>
</setup>
<setup name="mySetup2" alias="unit2InUnitlib"/>
<setup name="mySetup3">
<instance class="myClass" method="myMethod">
</setup>
...
</setups>
The unit library <unitlib>
The unit library of the repository contains the instance definitions of all necessary test units, setups, checkups and teardowns. At unit level there is no distinction between the unit types. This is only done within the test description so that e.g. the same instance may be used as setup in one scenario or as teardown in another.
The unit lib, as the name implies, only contains units. No further nesting into suites is possible here.
| Attribute | m/o | Description |
| import | o | The unitlib can contain an import attribute to reference further descriptor repositories. Several repositories can be given as a semicolon separated list. The repositories are expected relative to the inputpath of the "main" repository as defined in the configuration file. The reference refers to the unitlib element in the imported repository. |
| Element | m/o | Description |
| unit | o | The unitlib may contain an unlimited number of elements that define the instance of a test unit, setup, teardown etc. From the test description the units are referenced via an alias attribute that must correspond to the name of the unit in the unitlib. |
Example:
<unitlib import="unitlib1.xml;unitlib2.xml">
<unit name="unitname">
<parameters>
<parameter name="user" value="default_user"/>
<parameter name="pass" value="default_password"/>
</parameters>
<instance class="org.ivalidator.testapp.test.LoginTest" method="testLoginSuccessful"/>
</unit>
<unit>...</unit>
</unitlib>
The <unit> Element
Attribute | m/o | Description |
| name | m | The units are indentified by a unique name. For a unit within the unitlib the name is a mandatory attribute. This is not supplied by the schema (because the unittype definition in the schema is meant for the units in the unitlib as well as in the test descriptions where the name is optional), but is checked during the input of the repository. The uniqueness of the name is expected by the xml repository but not verified. In case there are more than one units of the same name, only the first is applied. |
| alias | n/a | For a unit within the unitlib the alias attribute is not applicable even if the W3C schema would allow it (because the unittype definition in the schema is meant for the units in the unitlib as well as in the test descriptions) |
| Element | m/o | Description |
| parameters | o | Parameters may be supplied for a unit. As with the test definitions references to the parameterlib via parametergroup alias are possible. The parameter definitions in the unit lib can be seen as default values, they may be overwritten by the referencing tests, setups, teardowns, etc. |
| instance | m | The main purpose of the unit definition is to supply unit implementation in the form of a class and method. The testrunner checks during the validation run if the given class and method are available on the classpath given in the configuration file for this repository. |
The Parameter Library <parameterlib>
The parameter library of the repository contains parametergroups that may be referenced by an test or unit within the test descriptions as well as the unit library.
| Attribute | m/o | Description |
| import | o | The parameterlib can contain an import attribute to reference further descriptor repositories. Several repositories can be given as a semicolon separated list. The repositories are expected relative to the importing repositories' location or on the inputpath of the "main" repository as defined in the configuration file. The reference refers to the parameterlib element in the imported repository. |
| Element | m/o | Description |
| parametergroup | o | The parameterlib may contain an unlimited number of parametergroup elements that define a group of parameters and parameterlists. From the test description the parametergroups are referenced via an alias attribute that must correspond to the name of the parametergroup in the parameterlib. |
Example:
<parameterlib import="parameterlib1.xml;parameterlib2.xml">
<parametergroup name="loginGroup">
<parameterlist name="logins">
<parameterlistentry>
<parameter name="user" value="user1"/>
<parameter name="pass" value="password1"/>
</parameterlistentry>
<parameterlistentry>
<parameter name="user" value="user2"/>
<parameter name="pass" value="password2"/>
</parameterlistentry>
</parameterlist>
<parameter name="domain" value="xyz"/>
<parameter name="timeout" value="1000"/>
</parametergroup>
<parametergroup>...</parametergroup>
</parameterlib>
The <parametergroup> element

| Attribute | m/o | Description |
| name | m | The parametergroups are indentified by a unique name. For a parametergroup within the parameterlib the name is a mandatory attribute. This is not supplied by the schema (because the parametergrouptype definition in the schema is meant for the parametergroups in the parameterlib as well as in the test descriptions where the name is optional), but is checked during the input of the repository. The uniqueness of the name is expected by the xml repository but not verified. In case there are more than one parametergroups of the same name, only the first is applied. |
| alias | n/a | For a parametergroup within the parameterlib the alias attribute is not applicable even if the W3C schema allows it because the parametergrouptype definition in the schema is meant for the parametergroups in the parameterlib as well as in the test descriptions). |
| Element | m/o | Description |
| parameter | o | An unlimited number of parameters in the form of name / value pairs can be provided. The parameter value can be checked by the implementing unit(see validation run). A parameter from a parametergroup will be overwritten by a parameter of the same name in the referencing test description or unit definition. |
| parameterlist | o | An unlimited number of parameterlists can be provided. A parameterlist is identified by its unique name. It has 0-n list entries that constitute groups of parameters with equal names and different values. The entries are identified implicitly by their index in the parameterlist. The validation run can be used to verify that the contents of the parameter list entries are valid. A parameterlist from a parametergroup will be overwritten by a parameterlist of the same name in the referencing test description or unit definition. |
The adapter library <adapterlib>
The adapter library provides adapter settings for the framework that are required by the test implementaitons. Other than the parameter lib and the unit lib the adapterlib is not used for the structuring of the test descriptions and resolved during the input of the descriptor repository but the adapterlist is directly requested from the framework (interface DescriptorRepository, method AdapterDescriptor[] getAdapterDescriptors()).
| Attribute | m/o | Description |
| import | o | The adapterlib can contain an import attribute to reference further descriptor repositories. Several repositories can be given as a semicolon separated list. The repositories are expected relative to the importing repositories' location or on the inputpath of the "main" repository as defined in the configuration file. The reference refers to the adapterlib element in the imported repository. |
| Element | m/o | Description |
| adapter | o | The adapterlib may contain an unlimited number of adapter elements. |
Example:
<adapterlib import="adapterlib.xml">
<adapter name="adaptername" class="org.ivalidator.adapters.MyAdapter">
<parameters>
<parameter name="param1" value="value1"/>
</parameters>
</adapter>
<adapter>...</adapter>
</adapterlib>
The <adapter> element
| Attribute | m/o | Description |
| name | m | The adapters are identified by a unique name. |
| class | m | The adapter class. Details for the implementation of an adapter can be found in the section adapter. |
| Element | m/o | Description |
| parameters | o | For an adapter parameters can be defined according to the same rules as for tests and units including references to the parameter lib. |
The XML Report Repository <report-repository>
The xml repository creates one report for the validation run and one for the test run of every descriptor repository. If the configuration file contains more than one descriptor repository there will be a corresponding number of reports. The report is updated after every step during the test run so that the results are available up to the current test in the hierarchy at any point during the test run.
The filenames for the report repositories are automatically created from a prefix and the timestamp of the run. The reports of the validation run are named "validate-DD.MM.CCYY_hh_mm_ss.xml", the reports of the test run are named "execute-DD.MM.CCYY_hh_mm_ss.xml"
The structure of the xml report repository is very simple. Every entity in the test (suites, test units, setups, teardowns, checkups) have the same result entry. The structure of the report is mainly the same as that of the testhierachy, only the "brackets" <setups>, <checkups>, <teardowns>, as well as <flow> are missing.
A different structure may occur, if for example after an error the rule "next_test_inits" is applied. Then the report will contain teardown and setup entries between two tests that are not defined in the test description.
Example of a report:
<report xmlns="http://www.ivalidator.org/schemas/xml-repository">
<type>test</type>
<name>FULL_TEST_SUITE</name>
<result>success</result>
<start-time>2005-01-26T16:46:21.015+01:00</start-time>
<end-time>2005-01-26T16:46:21.676+01:00</end-time>
<duration>00:00:00.661</duration>
<setup>
<type>setup</type>
<name>startServer</name>
<result>success</result>
<note></note>
<start-time>2005-01-26T16:46:21.015+01:00</start-time>
<end-time>2005-01-26T16:46:21.035+01:00</end-time>
<duration>00:00:00.020</duration>
</setup>
<test>
<type>test</type>
<name>Successful_Login</name>
<result>success</result>
<start-time>2005-01-26T16:46:21.246+01:00</start-time>
<end-time>2005-01-26T16:46:21.476+01:00</end-time>
<duration>00:00:00.230</duration>
<test>
<type>test</type>
<name>testLoginSuccessful</name>
<result>success</result>
<note></note>
<start-time>2005-01-26T16:46:21.246+01:00</start-time>
<end-time>2005-01-26T16:46:21.246+01:00</end-time>
<duration>00:00:00.000</duration>
</test>
<checkup>
<type>checkup</type>
<name>checkupLogin</name>
<result>success</result>
<note></note>
<start-time>2005-01-26T16:46:21.376+01:00</start-time>
<end-time>2005-01-26T16:46:21.376+01:00</end-time>
<duration>00:00:00.000</duration>
</checkup>
</test>
<teardown>
<type>teardown</type>
<name>stopServer</name>
<result>success</result>
<note></note>
<start-time>2005-01-26T16:46:21.586+01:00</start-time>
<end-time>2005-01-26T16:46:21.586+01:00</end-time>
<duration>00:00:00.000</duration>
</teardown>
</report>
