Instance variables


Version 1.20 introduces the notion of instance variable. This option offers the opportunity to define a single test and execute it several time with small details changing. These small details are handled by variables.

Instance-settling

To define that a test must be executed several times, you must specify an xml element named instance-settling. This element is expecting a single variable (element local-variable) having a name and a type. The different values that this variable will take can be defined by the means of a sequence.

<instance-settling>
  <local-variable name="firstDayOfMonth" type="dateTime">
    <loop-sentinel seed="2016-01-01" terminal="2016-03-01" step="1 month"/>
  </local-variable>
</instance-settling>

Customize categories, traits and name

Based on the value of the local-variable, you can customize the name of the test but also the categories and traits.

To achieve this add some xml elements in the instance-settling such as category and trait.

<test name="~Instance also defines the test's name and categories and traits for {@firstDayOfMonth:MMMM}" uid="0002">
  <instance-settling>
    <local-variable name="firstDayOfMonth" type="dateTime">
      <loop-sentinel seed="2016-01-01" terminal="2016-03-01" step="1 month"/>
    </local-variable>
    <category>~{@firstDayOfMonth:MMMM}</category>
    <trait name="Year">~{@firstDayOfMonth:yyyy}</trait>
    <trait name="Month">~{@firstDayOfMonth:MM}</trait>
    <trait name="Date">@firstDayOfMonth</trait>
  </instance-settling>
  ...
</test>