Check that the string begins with the text generating an exception otherwise.
1 assert.startsWith
It is ideal for test units because it emulates JUnit.
Release 2017.2
Tag available since version 2017.2.
<assert.startsWith
text='text'
string='string'
/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Atext | string | Text by which the string must start. | |||
Astring | string | String to check. |
Returns | |
---|---|
Type | Description |
Exception | Returns an exception if the string does not begin by the text. |
Example
Copy
<xsql-script> <body> <set name='m_text'>Hallo</set> <set name='m_b'>Hello world!</set> <assert.startsWith><m_text /><m_b /></assert.startsWith> </body> </xsql-script>
Error: XSQLScriptException[Assert failed: expected [Hallo] != received [Hello world!] (java.lang.String, java.lang.String)]