Affirm supports both JSON-path and XML-path when plucking values from complex data objects.
Scenario: Test CSV sample
Given some CSV as test:
<pre>
</pre>
Then $.[0].what in test should match hello
And $.[0].who in test should match world
And $.[1].what in test should match greetings
And $.[1].who in test should match earthling
The following example creates a JSON data structure from the supplied CSV.
[
{ "what": "hello", "who": "world" },
{ "what": "greetings", "who": "earthling" }
]
See http://goessner.net/articles/JsonPath/ for more information on JSON path. There are many XPATH tutorials, for example: http://archive.oreilly.com/pub/a/perl/excerpts/system-admin-with-perl/ten-minute-xpath-utorial.html
A similar approach is used to test XPATH expressions.
Several statements support arbitrary Javascript, for example: "I return" and "I assert".
The javscript is executed in the current context - which means that the function has direct access to in-flight meta-data such as request, response, cookies, etc.
Scenario: Request Google homepage - with redirects
Given I enable redirects
When I GET http://google.com/
And I return this.response.statusCode==200 as NoRedirect
THEN variable NoRedirect should be true
THEN I assert this.response.statusCode!=500
Scenario: Set & Test JSON sample
Given I set some-variable to JSON:
<pre>
</pre>
And earth.moon in some-variable should match cheese
And I assert this.features.var['some-variable'].hello=="world"
And I assert this.request.headers['Content-Type']=="application/json"
Dialect can send you a web hook notifications via Slack.
To confirm it simply add a section to your JSON config file:
{
"webhooks": {
"slack": {
"username": "dialect-bot",
"channel": "#featureing",
"url": "https://hooks.slack.com/services/XXXXXXXXX/YYYYYYYY/ZZZZZZZZ"
}
}
}
Once you have an active Slack account then obtain a new Slack webhook URL
You will receive events when features start, end or fail.