-
Notifications
You must be signed in to change notification settings - Fork 3
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.
- Declare unit tests cases
- Arrange define a context
- Fixtures define reusable arrange
- Cases enumerates the list of cases to loop through
- Act execute an action with the specified context
- Assert test the result of the action
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.
It’s the root node of the test file.
- Require
- [1 ]
- Child nodes: <units>, <testCases>
<?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>
It’s the root node for the unit tests.
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>
Define a test case.
- Require
- [1..n]
- Parent node: <units>
- Child nodes: <arrange>, <asserts>, <fake_output>
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>
The arrange section provides the context of the ADX execution:
- <Survey> Fake the survey and the current question currently running (used the Askia Survey XML format)
- <browser> Fake the AskiaScript Browser Object
- <output> Fake the selection of the ADX output to use during the test
- <properties> Fake the value of the ADX properties
Fake the ADX context.
- Optional
- [0..1]
- Parent node: <test>, <fixture>, <case>
- Child nodes: <output>, <browser>, <Survey>, <properties>
Simulate the selection of the specified output.
- Optional
- [0..1]
- Parent node: <arrange>
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>
Fake the AskiaScript Browser Object
- Optional
- [0..1]
- Parent node: <arrange>
- Child nodes: <resolution>, <support>, <pluginVersion>
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>
Fake the resolution of AskiaScript Browser Object
- Optional
- [0..1]
- Parent node: <browser>
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>
Fake the return value of Browser.Support() method. See also AskiaScript Browser Object
- Optional
- [0..n]
- Parent node: <browser>
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>
Fake the return value of Browser.PluginVersion() method. See also AskiaScript Browser Object
- Optional
- [0..n]
- Parent node: <browser>
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>
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)
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>
Fake the value set on the ADX properties.
- Optional
- [0..1]
- Parent node: <arrange>
- Child nodes: <property>
Fake the value set on an ADX property
- Require
- [1..n]
- Parent node: <properties>
- Child nodes: <value>
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>
Value of the ADX Property to fake.
- xsd:string
- Require
- [1 ]
- Parent node: <property>
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.
Root node of the fixture file.
- Require
- [1 ]
- Child nodes: <arrange>
<?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>
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”
Root node of the cases file.
- Require / Optional when uses in the Design6_ADX_Unit_tests#lttestsgt node
- [1 ]
- Parent node: none or <tests>
- Child nodes: <cases>
<?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>
Define or/and aggregate cases.
- [1..n]
- Parent node: <testCases>
- Child nodes: <case>
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 |
Define a case.
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 |
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
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.
- Optional
- [0..1]
- Parent node: <test>
- Child nodes: <page>, <head>, <placeholder>, <foot>
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>
Simulate the page generated for an ADP.
- xsd:string
- Optional
- [0..1]
- Parent node: <fake_output>
For ADC only
Simulate the head section generated for an ADC.
- xsd:string
- Optional
- [0..1]
- Parent node: <fake_output>
For ADC only
Simulate the placeholder section generated for an ADC.
- xsd:string
- Optional
- [0..1]
- Parent node: <fake_output>
For ADC only
Simulate the foot section generated for an ADC.
- xsd:string
- Optional
- [0..1]
- Parent node: <fake_output>
The ADXShell provides a set of assertions to execute against the data resulting of the Act section.
Asserts against the result of the ADX Engine outputs.
- Require
- [1 ]
- Parent node: <test>, <case>
- Child nodes: <assert_output>, <assert_not_output>,
<assert_error>, <assert_not_error>,
<assert_empty>, <assert_not_empty>,
<assert_match>, <assert_not_match>,
<page>, <head>, <placeholder>, <foot>
Assert that the specified output has been used.
- Optional
- [0..1]
- Parent node: <asserts>
Attribute name | Require | Type | Description |
---|---|---|---|
id | true | xsd:normalizedString | Id of the output to test |
<asserts>
<assert_output id="one_valid_condition" />
</asserts>
Asserts that the specified output has not been used.
- Optional
- [0..1]
- Parent node: <asserts>
Attribute name | Require | Type | Description |
---|---|---|---|
id | true | xsd:normalizedString | Id of the output to test |
<asserts>
<assert_not_output id="one_valid_condition" />
</asserts>
Asserts that the ADX engine has produce an error.
- Optional
- [0..1]
- Parent node: <asserts>
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>
Asserts that the ADX engine has not produce an error or the specified error code.
- Optional
- [0..1]
- Parent node: <asserts>
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>
Asserts that the specified output, the selected nodes or the current section is empty.
- Optional
- [0..1]
- Parent node: <asserts>, <page>, <head>, <placeholder>, <foot>, <select_nodes>
<asserts>
<assert_empty />
</asserts>
<asserts>
<placeholder>
<assert_empty />
</placeholder>
</asserts>
<asserts>
<placeholder>
<select_nodes xPath="//script">
<assert_empty />
</select_nodes>
</placeholder>
</asserts>
Asserts that the specified output, the selected nodes or the current section is not empty.
- Optional
- [0..1]
- Parent node: <asserts>, <page>, <head>, <placeholder>, <foot>, <select_nodes>
<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>
Asserts that the specified output, the selected nodes or the current section match the specified regular expression.
- xsd:string
- Optional
- [0..1]
- Parent node: <asserts>, <page>, <head>, <placeholder>, <foot>, <select_nodes>
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>
Asserts that the specified output, the selected nodes or the current section doesn’t match the specified regular expression.
- xsd:string
- Optional
- [0..1]
- Parent node: <asserts>, <page>, <head>, <placeholder>, <foot>, <select_nodes>
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>
Container of the asserts to execute on the page (ADP).
- Optional
- [0..1]
- Parent node: <asserts>
- Child nodes: <assert_empty>, <assert_not_empty>,
<assert_equals>, <assert_not_equals>,
<assert_contains>, <assert_not_contains>,
<assert_match>, <assert_not_match>,
<select_nodes>
<asserts>
<page>
<assert_contains><![CDATA[default.js]]></assert_contains>
</page>
</asserts>
Container of the asserts to execute on the head section (ADC only).
- Optional
- [0..1]
- Parent node: <asserts>
- Child nodes: <assert_empty>, <assert_not_empty>,
<assert_equals>, <assert_not_equals>,
<assert_contains>, <assert_not_contains>,
<assert_match>, <assert_not_match>,
<select_nodes>
<asserts>
<head>
<assert_contains><![CDATA[default.js]]></assert_contains>
</head>
</asserts>
Container of the asserts to execute on the placeholder section (ADC only).
- Optional
- [0..1]
- Parent node: <asserts>
- Child nodes: <assert_empty>, <assert_not_empty>,
<assert_equals>, <assert_not_equals>,
<assert_contains>, <assert_not_contains>,
<assert_match>, <assert_not_match>,
<select_nodes>
<asserts>
<placeholder>
<assert_contains><![CDATA[default.js]]></assert_contains>
</placeholder>
</asserts>
Container of the asserts to execute on the foot section (ADC only).
- Optional
- [0..1]
- Parent node: <asserts>
- Child nodes: <assert_empty>, <assert_not_empty>,
<assert_equals>, <assert_not_equals>,
<assert_contains>, <assert_not_contains>,
<assert_match>, <assert_not_match>,
<select_nodes>
<asserts>
<foot>
<assert_contains><![CDATA[default.js]]></assert_contains>
</foot>
</asserts>
Asserts that the specified output, the selected nodes or the current section is equal to the specified string.
- xsd:string
- Optional
- [0..1]
- Parent node: <page>, <head>, <placeholder>, <foot>, <select_nodes>
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>
Asserts that the specified output, the selected nodes or the current section is not equal to the specified string.
- xsd:string
- Optional
- [0..1]
- Parent node: <page>, <head>, <placeholder>, <foot>, <select_nodes>
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>
Asserts that the specified output, the selected nodes or the current section contains the specified string.
- xsd:string
- Optional
- [0..1]
- Parent node: <page>, <head>, <placeholder>, <foot>, <select_nodes>
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>
Asserts that the specified output, the selected nodes or the current section doesn’t contains the specified string.
- xsd:string
- Optional
- [0..1]
- Parent node: <page>, <head>, <placeholder>, <foot>, <select_nodes>
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>
Container of assert to execute on HTML nodes in the current section.
- Optional
- [0..n]
- Parent node: <page>, <head>, <placeholder>, <foot>
- Child nodes: <assert_count>,
<assert_empty>, <assert_not_empty>,
<assert_exist>, <assert_not_exist>,
<assert_equals>, <assert_not_equals>,
<assert_contains>, <assert_not_contains>,
<assert_match>, <assert_not_match>,
<assert_has_attr>, <assert_has_not_attr>
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>
Asserts against the number of selected HTML nodes.
- Optional
- [0..1]
- Parent node: <select_nodes>
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>
Asserts that the specified HTML nodes exist.
- Optional
- [0..1]
- Parent node: <select_nodes>
<asserts>
<placeholder>
<select_nodes xPath="//script">
<assert_exist />
</select_nodes>
</placeholder>
</asserts>
Asserts that the specified HTML nodes doesn’t exist.
- Optional
- [0..1]
- Parent node: <select_nodes>
<asserts>
<placeholder>
<select_nodes xPath="//script">
<assert_not_exist />
</select_nodes>
</placeholder>
</asserts>
Asserts that the specified HTML nodes has the specified attribute.
- Optional
- [0..n]
- Parent node: <select_nodes>
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>
Asserts that the specified HTML nodes has not the specified attribute.
- Optional
- [0..n]
- Parent node: <select_nodes>
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>>