diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-10-29 18:37:26 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-12-11 12:20:32 +0000 |
commit | 16922b73bf17b2f23148438957cd3d18542075f4 (patch) | |
tree | 20355189f7f5f2262e7fe31be0b7119b07182ab1 /docs/Reference/1_BindingAssertFunctions.md | |
parent | 77ca03276ea3bb12873a1b69b1726d4e99f8dead (diff) |
Docs reorganization and update
Docs reorganization and update using the latest afb-test improvments and
try to make it clearer.
Change-Id: If022cdb46364ef250361bdcd420d45b360f10a2e
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
(cherry picked from commit 2f3654275e44f9719818a848da9a0b576d5a1b53)
Diffstat (limited to 'docs/Reference/1_BindingAssertFunctions.md')
-rw-r--r-- | docs/Reference/1_BindingAssertFunctions.md | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/docs/Reference/1_BindingAssertFunctions.md b/docs/Reference/1_BindingAssertFunctions.md new file mode 100644 index 0000000..b05f73b --- /dev/null +++ b/docs/Reference/1_BindingAssertFunctions.md @@ -0,0 +1,75 @@ +# Binding Assert functions + +* **_AFT.assertVerbStatusSuccess(api, verb, args)** + + Simply test that the call of a verb successfully returns. + +* **_AFT.assertVerbStatusError(api, verb, args)** + + The inverse of above. Expects that the verbs fails. + +* **_AFT.assertVerbResponseEquals(api, verb, args, expectedResponse)** + + Test that the call of a verb successfully returns and that verb's response + is equal to the *expectedResponse*. + +* **_AFT.assertVerbResponseEqualsError(api, verb, args, expectedResponse)** + + The inverse of above. Expect an error on the verb call either on the verb or on the expected + response. + +* **_AFT.assertVerbCb(api, verb, args, expectedResponse, callback)** + + Test the call of a verb with a custom callback. From this callback you + will need to make some assertions on what you need (verb JSON return object + content mainly). + + If you don't need to test the response simply specify an empty LUA table. + + ```lua + function _callback(responseJ) + _AFT.assertStrContains(responseJ.response, "Some String") + end + + _AFT.describe("myTestLabel", function() + _AFT.testVerbCb('testPingSuccess','hello', 'ping', {}, _callback) + end) + ``` + +* **_AFT.assertVerbCbError(api, verb, args, expectedResponse, callback)** + + Should return success on failure. + +* **_AFT.assertEvtReceived(eventName, timeout)** + + Prior to be able to check that an event has been received, you have to + register the event with the test framework using **_AFT.addEventToMonitor** + function. + + Check if an event has been correctly received in timeout specified (timeout in µs). + An event name use the application framework naming scheme: **api/event_name**. + +* **_AFT.assertEvtNotReceived(eventName, timeout)** + + Prior to be able to check that an event has been received, you have to + register the event with the test framework using **_AFT.addEventToMonitor** + function. + + Check if an event has been correctly received in time (timeout in µs). + An event name use the application framework naming scheme: **api/event_name**. + +* **_AFT.assertGrpEvtReceived(eventGrp, timeout)** + + Prior to be able to check that a group of events (a table of event) has been + received, you have to register the events with the test framework using + **_AFT.addEventToMonitor** function. + + The table has to have this format: + ```lua + eventGrp = {["api/event_name_1"]=1,["api/event_name_2"]=2,["api/event_name_3"]=5} + ``` + As you can see, in the table, event names are table keys and the value stored are + the number of time that the events have to be received. + + Check if events has been correctly received in timeout specified (timeout in µs). + An event name use the application framework naming scheme: **api/event_name**.
\ No newline at end of file |