Skip to content
Mamadou Sy edited this page Sep 22, 2016 · 8 revisions

Unit tests

ADX is provided with a unit-tests tool named ADXShell.
This tool uses a native implementation of the Askia Rendering Engine (Design.exe’s screen mode or AskiaExt.dll).

The unit tests of the ADX are XML-based.
The XML which defines a unit test should implements the ADXUnitTest.xsd schema.

All tests should be placed in the /tests/ folder of the ADX.

It could also auto-generate unit tests in memory to test each output on each questions and validate that it doesn’t generate an error and that the final output is not empty.

ADXShell is based on the Test design pattern AAA.

  1. Declare unit tests cases
  2. Arrange define a context
  3. Fixtures define reusable arrange
  4. Cases enumerates the list of cases to loop through
  5. Act execute an action with the specified context
  6. Assert test the result of the action

Declaration

All xml files under the /tests/units/ directory are considered as a set of tests cases.
You can place several tests cases in a single file or split them into several files.

↑ Top of page ↑

<tests>

It’s the root node of the test file.

<?xml version="1.0" encoding="utf-8"?>
<tests xmlns="http://www.askia.com/2.1.0/ADXUnitTestSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.askia.com/2.1.0/ADXUnitTestSchema https://raw.githubusercontent.com/AskiaADX/ADXSchema/2.1.0/ADXUnitTests.xsd">

<!-- ... rest of the document ... -->

</tests>

↑ Top of page ↑

<units>

It’s the root node for the unit tests.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
fixture false xsd:normalizedString Name of the fixture file that will be use across all tests
ignore false xsd:boolean Ignore all tests while running unit test engine
<?xml version="1.0" encoding="utf-8"?>
<tests xmlns="http://www.askia.com/2.1.0/ADXUnitTestSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.askia.com/2.1.0/ADXUnitTestSchema https://raw.githubusercontent.com/AskiaADX/ADXSchema/2.1.0/ADXUnitTests.xsd">

  <units fixture="multiple.xml">
      <!-- All tests -->
  </units>
</tests>

↑ Top of page ↑

<test>

Define a test case.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
id true xsd:normalizedString Identifier of the test case
description false xsd:normalizedString Description of the test case
fixture false xsd:normalizedString Name of the fixture file to use in the test case
cases false xsd:normalizedString Ids of cases separate with coma delimiter on which the test should loop through.
It will run the one test for each cases
ignore false xsd:boolean Ignore the test while running unit test engine
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
     <!-- Arrange -->
  </arrange>

  <asserts>
     <!-- Asserts -->
  </asserts>
</test>

↑ Top of page ↑

Arrange Section

The arrange section provides the context of the ADX execution:

↑ Top of page ↑

<arrange>

Fake the ADX context.

↑ Top of page ↑

<output>

Simulate the selection of the specified output.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
id true xsd:NCName Identifier of output to select during the test case
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
    <output id="fallback"/>
  </arrange>

   <!-- asserts -->
</test>

↑ Top of page ↑

<browser>

Fake the AskiaScript Browser Object

↑ Top of page ↑

Attributes

Attribute name Require Type Description
name false xsd:normalizedString Name of the browser
version false xsd:normalizedString Version of the browser
os false xsd:normalizedString Name of the Operating System
userAgent false xsd:string User-agent
mobile false xsd:boolean True to emulate mobile device
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
    <browser name="Internet Explorer" version="10" os="Windows" mobile="false"/>
  </arrange>

   <!-- asserts -->
</test>

↑ Top of page ↑

<resolution>

Fake the resolution of AskiaScript Browser Object

↑ Top of page ↑

Attributes

Attribute name Require Type Description
screenAvailWidth false xsd:positiveInteger Available screen width
screenAvailHeight false xsd:positiveInteger Available screen height
screenWidth false xsd:positiveInteger Screen width
screenHeight false xsd:positiveInteger Screen height
screenColorDepth false xsd:positiveInteger Color depth supported
windowWidth false xsd:positiveInteger Window width
windowHeight false xsd:positiveInteger Window height
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
    <browser name="Internet Explorer" version="10" os="Windows" mobile="false">
       <resolution windowWidth="900" windowHeight="700" />
    </browser>
  </arrange>

   <!-- asserts -->
</test>

↑ Top of page ↑

<support>

Fake the return value of Browser.Support() method. See also AskiaScript Browser Object

↑ Top of page ↑

Attributes

Attribute name Require Type Description
name true xsd:normalizedString Name of the support feature.
Also see: Browser Feature keys
value true xsd:boolean Fake value associated with that support feature
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
    <browser name="Internet Explorer" version="10" os="Windows" mobile="false">
       <support name="javascript" value="true" />
       <support name="flash" value="false" />
    </browser>
  </arrange>

   <!-- asserts -->
</test>

↑ Top of page ↑

<pluginVersion>

Fake the return value of Browser.PluginVersion() method. See also AskiaScript Browser Object

↑ Top of page ↑

Attributes

Attribute name Require Type Description
name true xsd:normalizedString Name of the plugin.
Also see: Browser Plugin keys
value true xsd:normalizedString Fake version associated with that plugin
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
    <browser name="Internet Explorer" version="10" os="Windows" mobile="false">
       <support name="Flash" value="11.2.202.235" />
    </browser>
  </arrange>

   <!-- asserts -->
</test>

↑ Top of page ↑

<Survey>

Emulate the survey structure. Create a survey in Askia Design.exe and export it to “Askia XML” format then make sure to add all following required attributes.

  • Optional
  • [0..1]
  • Parent node: <arrange>
  • Child nodes: Any (relaxed)

↑ Top of page ↑

Attributes

Attribute name Require Type Description
Name true xsd:string Name of the survey
CurrentQuestion true xsd:string Shortcut of the current question.
The one that will be associated with the ADC
{Any} false All any attributes are allowed (relaxed)
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
      <Survey Name="DateSurvey" CurrentQuestion="datetime" Version="1.0" Full="1" MaxQuestionID="1" MaxResponseID="2">
      <Languages>
      <Language ID="2057" Abbr="ENG" Name="English (United Kingdom)" Default="1"/>
      </Languages>
      <Questions>
      <Question ID="1" Shortcut="datetime" Order="1" ElementType="question" AllowDK="1" QuestionType="date" DateType="0" Translated="0">
      <LongCaption>datetime</LongCaption>
      </Question>
      </Questions>
    </Survey>
  </arrange>

  <!-- asserts -->
</test>

↑ Top of page ↑

<properties>

Fake the value set on the ADX properties.

↑ Top of page ↑

<property>

Fake the value set on an ADX property

↑ Top of page ↑

Attributes

Attribute name Require Type Description
id true xsd:normalizedString Id of the property to fake
<test id="not_empty" description="The placeholder section should not be empty">
  <arrange>
    <properties>
       <property id="backgroundColor">
          <value>#ffffff</value>
    </properties>
  </arrange>

   <!-- asserts -->
</test>

↑ Top of page ↑

<value>

Value of the ADX Property to fake.

↑ Top of page ↑

Fixtures Section

Because sometimes tests use the same arrange, the fixture allow developers to partially arrange the test in a separate file and include that arrange in the unit test files.
This type of shared context is call a fixture.
The fixtures directory contains .xml files which implements the ADXUnitTests.xsd in order to create a shared arrange across tests.

For examples:

  • Create a fixture file SurveyA.xml which contains the XML definition of the survey that will be use by several unit tests
  • Create a fixture file BrowserMobile.xml which fake a mobile browser
  • Create a fixture file Firefox.xml which fake a Firefox browser

All fixtures should be placed in the /tests/fixtures/ folder of the ADX.

↑ Top of page ↑

<fixture>

Root node of the fixture file.

<?xml version="1.0" encoding="utf-8"?>
<fixture xmlns="http://www.askia.com/2.1.0/ADXUnitTestSchema"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.askia.com/2.1.0/ADXUnitTestSchema https://raw.githubusercontent.com/AskiaADX/ADXSchema/2.1.0/ADXUnitTests.xsd">
  <arrange>
      <Survey Name="DateSurvey" CurrentQuestion="datetime" Version="1.0" Full="1" MaxQuestionID="1" MaxResponseID="2">
      <Languages>
      <Language ID="2057" Abbr="ENG" Name="English (United Kingdom)" Default="1"/>
      </Languages>
      <Questions>
      <Question ID="1" Shortcut="datetime" Order="1" ElementType="question" AllowDK="1" QuestionType="date" DateType="0" Translated="0">
      <LongCaption>datetime</LongCaption>
      </Question>
      </Questions>
    </Survey>
  </arrange>
</fixture>

↑ Top of page ↑

Cases Section

Most of the time some tests are really equivalent, there are only few difference between them.
Instead of copying tests over and over, which could be a pain to do and maintain, it is useful to loop through an enumeration of cases
and apply the tests contained within the loop.
The `cases` directory contains .xml files which implement the UnitTests.xsd in order to declare all enumerations that could be used to loop through.

For example, let’s imagine an ADX with two outputs: `fallback` / `withJavascript` which could works with numeric and single closed questions, we can write all the following cases:

  • “fallback output with numeric question”
  • “fallback output with single question”
  • “standard output with numeric question”
  • “standard output with single question”
  • “fallback outputs with all questions”
  • “standard outputs with all questions”
  • “all outputs with single question”
  • “all outputs with numeric question”
  • “all outputs with all questions”

↑ Top of page ↑

<testCases>

Root node of the cases file.

<?xml version="1.0" encoding="utf-8"?>
<testCases xmlns="http://www.askia.com/2.1.0/ADXUnitTestSchema"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://www.askia.com/2.1.0/ADXUnitTestSchema https://raw.githubusercontent.com/AskiaADX/ADXSchema/2.1.0/ADXUnitTests.xsd">

  <cases id="fallback_numeroc">
      <case description="fallback with numeric question" fixture="numeric.xml">
          <arrange>
               <output id="fallback" />
          </arrange>
      </case>
  </cases>

  <cases id="fallback_single">
      <case description="fallback with single closed question" fixture="single.xml">
          <arrange>
               <output id="fallback" />
          </arrange>
      </case>
  </cases>

  <cases id="standard_numeric">
      <case description="standard with numeric question" fixture="numeric.xml">
          <arrange>
               <output id="standard" />
          </arrange>
      </case>
  </cases>

  <cases id="standard_single">
      <case description="standard with single closed question" fixture="single.xml">
          <arrange>
               <output id="standard" />
          </arrange>
      </case>
  </cases>

  <cases id="fallback" cases="fallback_numeric, fallback_single" />
  <cases id="standard" cases="standard_numeric, standard_single" />

  <cases id="numeric" cases="fallback_numeric, standard_numeric" />
  <cases id="single" cases="fallback_single, standard_single" />

  <cases id="all" cases="fallback, standard" />
</testCases>

↑ Top of page ↑

<cases>

Define or/and aggregate cases.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
id true xsd:normalizedString Id of the cases
description false xsd:normalizedString Description of the cases
cases false xsd:normalizedString Id(s) of cases, separate with coma delimiter, to aggregate with the current cases.
All aggregated cases will run before the case defined in the current node

↑ Top of page ↑

<case>

Define a case.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
description true xsd:normalizedString Description of the case, it will prefix the final test description
fixture false xsd:normalizedString Name of the fixture file to use, it will be extended by the final fixture defined in the Design6_ADX_Unit_tests#ltunitsgt or Design6_ADX_Unit_tests#lttestgt node

↑ Top of page ↑

Act Section

The act is automatically done by the ADXShell, it will run the ADX using the fake context (Arrange section) and then will provide a set of data to test against:

  • ID of the selected output
  • Content of the `page` generated (for ADP)
  • Content of the `head` section generated (for ADC)
  • Content of the `placeholder` section generated (for ADC)
  • Content of the `foot` section generated (for ADC)
  • Error code

↑ Top of page ↑

<fake_output>

Emulate the output generated by the ADX engine.
Because sometimes it’s useful to validate that your assertions are correct, the <fake_output> node allows you to emulate the ADX engine results.
It could be useful to document your expectations or to validate the correctness of your assertions.

Note: running the tests against the <fake_output> doesn’t mean that your tests really passed, it doesn’t call the ADX Engine.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
id false xsd:normalizedString Simulate the id of the selected output
errorCode false Enumeration based on xsd:normalizedString
noError
No error
noQuestionnaire
No questionnaire defined
noControl
No ADC control
scriptingError
AskiaScript error
missingProperty
Missing property
missingContent
Missing content
invalidZip
ADX zip file is not valid
invalidXmlFile
Invalid config.xml file
invalidSWFFile
Invalid SWF file
missingFile
Missing file
invalidXml
Invalid xml string
missingCachedFile
Missing cached file
noOutput
No output
outputConditionError
Output condition error
binaryNoDynamic
Binary file could not be dynamic
binaryNeedsYield
Binary file require the element
cannotCreateDirectory
Cannot create the ADX directory
textNoStaticOrShare
Text content could not be static or share
missingAskiaHeadTag
Missing askia-head tag
missingAskiaFormTag
Missing askia-form tag
missingAskiaFormCloseTag
Missing askia-form close tag
missingAskiaQuestionsTag
Missing askia-questions tag
missingAskiaFootTag
Missing askia-foot tag
Simulate the error code return by the ADC engine
<fake_output id="html5Video" errorCode="noError">
  <head>
     <![CDATA[<link type="text/css" rel="stylesheet" href="../Resources/Survey/my_adc_name/style.css" />]]>
  </head>
  <placeholder>
     <![CDATA[<audio src="../Resources/Survey/my_adc_name/gizmo.ogv"></audio>]]>
  </placeholder>
  <foot>
     <![CDATA[<script type="text/javascript" src="../Resources/Survey/my_adc_name/audioControl.js"></script>]]>
  </foot>
</fake_output>

↑ Top of page ↑

<page> (Fake output)

Simulate the page generated for an ADP.

↑ Top of page ↑

<head> (Fake output)

For ADC only

Simulate the head section generated for an ADC.

↑ Top of page ↑

<placeholder> (Fake output)

For ADC only

Simulate the placeholder section generated for an ADC.

↑ Top of page ↑

<foot> (Fake output)

For ADC only

Simulate the foot section generated for an ADC.

↑ Top of page ↑

Assert Section

The ADXShell provides a set of assertions to execute against the data resulting of the Act section.

<asserts>

Asserts against the result of the ADX Engine outputs.

↑ Top of page ↑

<assert_output>

Assert that the specified output has been used.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
id true xsd:normalizedString Id of the output to test

      <asserts>
        <assert_output id="one_valid_condition" />
      </asserts>

↑ Top of page ↑

<assert_not_output>

Asserts that the specified output has not been used.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
id true xsd:normalizedString Id of the output to test

      <asserts>
        <assert_not_output id="one_valid_condition" />
      </asserts>

↑ Top of page ↑

<assert_error>

Asserts that the ADX engine has produce an error.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
code false Enumeration based on xsd:normalizedString
noError
No error
noQuestionnaire
No questionnaire defined
noControl
No ADC control
scriptingError
AskiaScript error
missingProperty
Missing property
missingContent
Missing content
invalidZip
ADX zip file is not valid
invalidXmlFile
Invalid config.xml file
invalidSWFFile
Invalid SWF file
missingFile
Missing file
invalidXml
Invalid xml string
missingCachedFile
Missing cached file
noOutput
No output
outputConditionError
Output condition error
binaryNoDynamic
Binary file could not be dynamic
binaryNeedsYield
Binary file require the element
cannotCreateDirectory
Cannot create the ADX directory
textNoStaticOrShare
Text content could not be static or share
missingAskiaHeadTag
Missing askia-head tag
missingAskiaFormTag
Missing askia-form tag
missingAskiaFormCloseTag
Missing askia-form close tag
missingAskiaQuestionsTag
Missing askia-questions tag
missingAskiaFootTag
Missing askia-foot tag
Error code to test against

      <asserts>
        <assert_error code="textNoStaticOrShare"/>
      </asserts>

↑ Top of page ↑

<assert_not_error>

Asserts that the ADX engine has not produce an error or the specified error code.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
code false Enumeration based on xsd:normalizedString
noError
No error
noQuestionnaire
No questionnaire defined
noControl
No ADC control
scriptingError
AskiaScript error
missingProperty
Missing property
missingContent
Missing content
invalidZip
ADX zip file is not valid
invalidXmlFile
Invalid config.xml file
invalidSWFFile
Invalid SWF file
missingFile
Missing file
invalidXml
Invalid xml string
missingCachedFile
Missing cached file
noOutput
No output
outputConditionError
Output condition error
binaryNoDynamic
Binary file could not be dynamic
binaryNeedsYield
Binary file require the element
cannotCreateDirectory
Cannot create the ADX directory
textNoStaticOrShare
Text content could not be static or share
missingAskiaHeadTag
Missing askia-head tag
missingAskiaFormTag
Missing askia-form tag
missingAskiaFormCloseTag
Missing askia-form close tag
missingAskiaQuestionsTag
Missing askia-questions tag
missingAskiaFootTag
Missing askia-foot tag
Error code to test against

      <asserts>
        <assert_not_error code="textNoStaticOrShare"/>
      </asserts>

↑ Top of page ↑

<assert_empty>

Asserts that the specified output, the selected nodes or the current section is empty.


      <asserts>
        <assert_empty />
      </asserts>

      <asserts>
        <placeholder>
            <assert_empty />
        </placeholder>
      </asserts>

      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_empty />
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_not_empty>

Asserts that the specified output, the selected nodes or the current section is not empty.


      <asserts>
        <assert_not_empty />
      </asserts>

      <asserts>
        <placeholder>
            <assert_not_empty />
        </placeholder>
      </asserts>

      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_not_empty />
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_match>

Asserts that the specified output, the selected nodes or the current section match the specified regular expression.

Attributes

Attribute name Require Type Description
insensitive false xsd:boolean Do an insensitive case comparison

      <asserts>
        <assert_match><![CDATA[<input type="(radio|checkbox)"(.*?)\/>]]></assert_match>
      </asserts>

      <asserts>
        <placeholder>
            <assert_match><![CDATA[<input type="(radio|checkbox)"(.*?)\/>]]></assert_match>
        </placeholder>
      </asserts>

      <asserts>
        <placeholder>
            <select_nodes xPath="//div">
                <assert_match><![CDATA[<input type="(radio|checkbox)"(.*?)\/>]]></assert_match>
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_not_match>

Asserts that the specified output, the selected nodes or the current section doesn’t match the specified regular expression.

Attributes

Attribute name Require Type Description
insensitive false xsd:boolean Do an insensitive case comparison

      <asserts>
        <assert_not_match><![CDATA[<input type="(radio|checkbox)"(.*?)\/>]]></assert_not_match>
      </asserts>

      <asserts>
        <placeholder>
            <assert_not_match><![CDATA[<input type="(radio|checkbox)"(.*?)\/>]]></assert_not_match>
        </placeholder>
      </asserts>

      <asserts>
        <placeholder>
            <select_nodes xPath="//div">
                <assert_not_match><![CDATA[<input type="(radio|checkbox)"(.*?)\/>]]></assert_not_match>
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<page>

Container of the asserts to execute on the page (ADP).


      <asserts>
        <page>
            <assert_contains><![CDATA[default.js]]></assert_contains>
        </page>
      </asserts>

↑ Top of page ↑

<head>

Container of the asserts to execute on the head section (ADC only).


      <asserts>
        <head>
            <assert_contains><![CDATA[default.js]]></assert_contains>
        </head>
      </asserts>

↑ Top of page ↑

<placeholder>

Container of the asserts to execute on the placeholder section (ADC only).


      <asserts>
        <placeholder>
            <assert_contains><![CDATA[default.js]]></assert_contains>
        </placeholder>
      </asserts>

↑ Top of page ↑

<foot>

Container of the asserts to execute on the foot section (ADC only).


      <asserts>
        <foot>
            <assert_contains><![CDATA[default.js]]></assert_contains>
        </foot>
      </asserts>

↑ Top of page ↑

<assert_equals>

Asserts that the specified output, the selected nodes or the current section is equal to the specified string.

Attributes

Attribute name Require Type Description
insensitive false xsd:boolean Do an insensitive case comparison

      <asserts>
        <assert_equals><![CDATA[<script type="text/javascript" src="../Resources/Survey/default.js"></script>]]></assert_equals>
      </asserts>

      <asserts>
        <head>
            <assert_equals><![CDATA[<script type="text/javascript" src="../Resources/Survey/default.js"></script>]]></assert_equals>
        </head>
      </asserts>

      <asserts>
        <foot>
            <select_nodes xPath="//script">
                <assert_equals><![CDATA[$(":#adc_id").doSomething();]]></assert_equals>
            </select_nodes>
        </foot>
      </asserts>

↑ Top of page ↑

<assert_not_equals>

Asserts that the specified output, the selected nodes or the current section is not equal to the specified string.

Attributes

Attribute name Require Type Description
insensitive false xsd:boolean Do an insensitive case comparison

      <asserts>
        <assert_not_equals><![CDATA[<script type="text/javascript" src="../Resources/Survey/default.js"></script>]]></assert_not_equals>
      </asserts>

      <asserts>
        <head>
            <assert_not_equals><![CDATA[<script type="text/javascript" src="../Resources/Survey/default.js"></script>]]></assert_not_equals>
        </head>
      </asserts>

      <asserts>
        <foot>
            <select_nodes xPath="//script">
                <assert_not_equals><![CDATA[$(":#adc_id").doSomething();]]></assert_not_equals>
            </select_nodes>
        </foot>
      </asserts>

↑ Top of page ↑

<assert_contains>

Asserts that the specified output, the selected nodes or the current section contains the specified string.

Attributes

Attribute name Require Type Description
insensitive false xsd:boolean Do an insensitive case comparison

      <asserts>
        <assert_contains><![CDATA[default.js]]></assert_contains>
      </asserts>

      <asserts>
        <placeholder>
            <assert_contains><![CDATA[default.js]]></assert_contains>
        </placeholder>
      </asserts>

      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_contains><![CDATA[default.js]]></assert_contains>
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_not_contains>

Asserts that the specified output, the selected nodes or the current section doesn’t contains the specified string.

Attributes

Attribute name Require Type Description
insensitive false xsd:boolean Do an insensitive case comparison

      <asserts>
        <assert_not_contains><![CDATA[default.js]]></assert_contains>
      </asserts>

      <asserts>
        <placeholder>
            <assert_not_contains><![CDATA[default.js]]></assert_contains>
        </placeholder>
      </asserts>

      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_not_contains><![CDATA[default.js]]></assert_contains>
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<select_nodes>

Container of assert to execute on HTML nodes in the current section.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
xPath true xsd:string xPath expression to select HTML nodes

      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_count is="equal" value="2" />
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_count>

Asserts against the number of selected HTML nodes.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
is false Enumeration based on xsd:normalizedString
equal (by default)
Equal to the specified value
different
Different than the specified value
lowerThan
Lower than the specified value
lowerOrEqualThan
Lower or equal than the specified value
greatherThan
Greather than the specified value
greatherOrEqualThan
Greather or equal than the specified value
Type of the comparison
value true xsd:integer Comparison value

      <asserts>
        <select_nodes xPath="//script[@src]">
             <assert_count is="equal" value="3" />
         </select_nodes>
      </asserts>

↑ Top of page ↑

<assert_exist>

Asserts that the specified HTML nodes exist.


      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_exist />
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_not_exist>

Asserts that the specified HTML nodes doesn’t exist.


      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_not_exist />
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_has_attr>

Asserts that the specified HTML nodes has the specified attribute.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
name true xsd:normalizedString Name of the attribute to search
value false xsd:string Assert that the attribute has the specified value
contains false xsd:string Assert that the attribute contains the specified value

      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_has_attr name="type" value="text/javascript" />
                <assert_has_attr name="src" contains="default.js" />
            </select_nodes>
            <select_nodes xPath="//link">
                <assert_has_attr name="rel" />
            </select_nodes>
        </placeholder>
      </asserts>

↑ Top of page ↑

<assert_has_not_attr>

Asserts that the specified HTML nodes has not the specified attribute.

↑ Top of page ↑

Attributes

Attribute name Require Type Description
name true xsd:normalizedString Name of the attribute to search
value false xsd:string Assert that the attribute has not the specified value
contains false xsd:string Assert that the attribute doesn’t contains the specified value

      <asserts>
        <placeholder>
            <select_nodes xPath="//script">
                <assert_has_not_attr name="src" />
            </select_nodes>
            <select_nodes xPath="//link">
                <assert_has_not_attr name="href" contains="default.css" />
            </select_nodes>
        </placeholder>
      </asserts>

<< Generate Askia HTML Inputs | Javascript – AJAX – Events s>>

Clone this wiki locally