aboutsummaryrefslogtreecommitdiffstats
path: root/docs/Reference/0_BindingTestFunctions.md
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-10-29 18:37:26 +0100
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-10-31 21:03:06 +0000
commit2f3654275e44f9719818a848da9a0b576d5a1b53 (patch)
treeff75764bbb2e3037f73f95a96ac5ed2fcba93465 /docs/Reference/0_BindingTestFunctions.md
parent2a7b4defe300dfe5eb19f775bd819e2d300b7453 (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>
Diffstat (limited to 'docs/Reference/0_BindingTestFunctions.md')
-rw-r--r--docs/Reference/0_BindingTestFunctions.md100
1 files changed, 100 insertions, 0 deletions
diff --git a/docs/Reference/0_BindingTestFunctions.md b/docs/Reference/0_BindingTestFunctions.md
new file mode 100644
index 0000000..8da86da
--- /dev/null
+++ b/docs/Reference/0_BindingTestFunctions.md
@@ -0,0 +1,100 @@
+# Binding Test functions
+
+* **_AFT.testVerbStatusSuccess(testName, api, verb, args, setUp, tearDown)**
+
+ Simply test that the call of a verb successfully returns.
+
+ *setUp* and *tearDown* are functions that can be added to your context,
+ it works just like **_AFT.beforeEach()** and **_AFT.afterEach()**,
+ *setUp* will be ran before your *testFunction* and **_AFT.beforeEach()**
+ (if set) functions, *tearDown* will be ran after your *testFunction* and
+ **_AFT.afterEach()** (if set) functions.
+
+* **_AFT.testVerbStatusError(testName, api, verb, args, setUp, tearDown)**
+
+ The inverse than above.
+
+ *setUp* and *tearDown* are functions that can be added to your context,
+ it works just like **_AFT.beforeEach()** and **_AFT.afterEach()**,
+ *setUp* will be ran before your *testFunction* and **_AFT.beforeEach()**
+ (if set) functions, *tearDown* will be ran after your *testFunction* and
+ **_AFT.afterEach()** (if set) functions.
+
+* **_AFT.testVerbResponseEquals(testName, api, verb, args, expectedResponse, setUp, tearDown)**
+
+ Test that the call of a verb successfully returns and that verb's response
+ is equals to the *expectedResponse*.
+
+ *setUp* and *tearDown* are functions that can be added to your context,
+ it works just like **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp*
+ will be ran before your *testFunction* and **_AFT.beforeEach()** (if set)
+ functions, *tearDown* will be ran after your *testFunction* and
+ **_AFT.afterEach()** (if set) functions.
+
+* **_AFT.testVerbResponseEqualsError(testName, api, verb, args, expectedResponse, setUp, tearDown)**
+
+ The inverse than above.
+
+ *setUp* and *tearDown* are functions that can be added to your context, it works
+ just like **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp* will be ran
+ before your *testFunction* and **_AFT.beforeEach()** (if set) functions,
+ *tearDown* will be ran after your *testFunction* and **_AFT.afterEach()** (if
+ set) functions.
+
+* **_AFT.testVerbCb(testName, api, verb, args, expectedResponse, callback, setUp, tearDown)**
+
+ 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.
+
+ *setUp* and *tearDown* are functions that can be added to your context, it works
+ just like **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp* will be ran
+ before your *testFunction* and **_AFT.beforeEach()** (if set) functions,
+ *tearDown* will be ran after your *testFunction* and **_AFT.afterEach()** (if
+ set) functions.
+
+* **_AFT.testVerbCbError(testName, api, verb, args, expectedResponse, callback, setUp, tearDown)**
+
+ Should return success on failure.
+
+ *setUp* and *tearDown* are functions that can be added to your context, it works
+ just like **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp* will be ran
+ before your *testFunction* and **_AFT.beforeEach()** (if set) functions,
+ *tearDown* will be ran after your *testFunction* and **_AFT.afterEach()** (if
+ set) functions.
+
+* **_AFT.testEvtReceived(testName, eventName, timeout, setUp, tearDown)**
+
+ 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.testEvtNotReceived(testName, eventName, timeout, setUp, tearDown)**
+
+ Prior to be able to check that an event has not been received, you have to
+ register the event with the test framework using **_AFT.addEventToMonitor**
+ function.
+
+ Check if an event has not been correctly received in time (timeout in µs). An
+ event name use the application framework naming scheme: **api/event_name**.
+
+* **_AFT.testGrpEvtReceived(testName, eventGrp, timeout, setUp, tearDown)**
+
+ Prior to be able to check that a group of event (a table of event) has been
+ received, you have to register the event 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 time (timeout in µs). An
+ event name use the application framework naming scheme: **api/event_name**. \ No newline at end of file