0ca593e99adc5ccf27c135a261c78c028ce15cf5
[AGL/documentation.git] / docs / 4_APIs_and_Services / 4.4_AGL_Test_Framework / 5_Reference / 1_BindingTestFunctions / BindingTestFunctions.md
1 ---
2 edit_link: ''
3 title: Binding Test Functions
4 origin_url: >-
5   https://git.automotivelinux.org/apps/app-afb-test/plain/docs/Reference/0_BindingTestFunctions.md?h=master
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/apis_services/master/app-afb-test-developer-guides-api-services-book.yml -->
9
10 # Binding Test functions
11
12 * **_AFT.testVerbStatusSuccess(testName, api, verb, args, setUp, tearDown)**
13
14     Simply test that the call of a verb successfully returns.
15
16     *setUp* and *tearDown* are functions that can be added to your context,
17     it works just like  **_AFT.beforeEach()** and **_AFT.afterEach()**,
18     *setUp* will be ran before your *testFunction* and **_AFT.beforeEach()**
19     (if set) functions, *tearDown* will be ran after your *testFunction* and
20     **_AFT.afterEach()**  (if set) functions.
21
22 * **_AFT.testVerbStatusError(testName, api, verb, args, setUp, tearDown)**
23
24     The inverse than above.
25
26     *setUp* and *tearDown* are functions that can be added to your context,
27     it works just like  **_AFT.beforeEach()** and **_AFT.afterEach()**,
28     *setUp* will be ran before your *testFunction* and **_AFT.beforeEach()**
29     (if set) functions, *tearDown* will be ran after your *testFunction* and
30     **_AFT.afterEach()**  (if set) functions.
31
32 * **_AFT.testVerbStatusSkipped(testName, api, verb, args, setUp, tearDown, msg)**
33
34     Skip a test.
35
36     *msg* is a message to indicate the reason why the test is skip,
37     it must contain your test name if you want to parse the output.
38     *setUp* and *tearDown* are functions that can be added to your context,
39     it works just like  **_AFT.beforeEach()** and **_AFT.afterEach()**,
40     *setUp* will be ran before your *testFunction* and **_AFT.beforeEach()**
41     (if set) functions, *tearDown* will be ran after your *testFunction* and
42     **_AFT.afterEach()**  (if set) functions.
43
44 * **_AFT.testVerbResponseEquals(testName, api, verb, args, expectedResponse, setUp, tearDown)**
45
46     Test that the call of a verb successfully returns and that verb's response
47     is equals to the *expectedResponse*.
48
49     *setUp* and *tearDown* are functions that can be added to your context,
50     it works just like  **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp*
51     will be ran before your *testFunction* and **_AFT.beforeEach()** (if set)
52     functions, *tearDown* will be ran after your *testFunction* and
53     **_AFT.afterEach()**  (if set) functions.
54
55 * **_AFT.testVerbResponseEqualsError(testName, api, verb, args, expectedResponse, setUp, tearDown)**
56
57     The inverse than above.
58
59     *setUp* and *tearDown* are functions that can be added to your context, it works
60     just like  **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp* will be ran
61     before your *testFunction* and **_AFT.beforeEach()** (if set) functions,
62     *tearDown* will be ran after your *testFunction* and **_AFT.afterEach()**  (if
63     set) functions.
64
65 * **_AFT.testVerbCb(testName, api, verb, args, expectedResponse, callback, setUp, tearDown)**
66
67     Test the call of a verb with a custom callback. From this callback you
68     will need to make some assertions on what you need (verb JSON return object
69     content mainly).
70
71     If you don't need to test the response simply specify an empty LUA table.
72
73     *setUp* and *tearDown* are functions that can be added to your context, it works
74     just like  **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp* will be ran
75     before your *testFunction* and **_AFT.beforeEach()** (if set) functions,
76     *tearDown* will be ran after your *testFunction* and **_AFT.afterEach()**  (if
77     set) functions.
78
79 * **_AFT.testVerbCbError(testName, api, verb, args, expectedResponse, callback, setUp, tearDown)**
80
81     Should return success on failure.
82
83     *setUp* and *tearDown* are functions that can be added to your context, it works
84     just like  **_AFT.beforeEach()** and **_AFT.afterEach()**, *setUp* will be ran
85     before your *testFunction* and **_AFT.beforeEach()** (if set) functions,
86     *tearDown* will be ran after your *testFunction* and **_AFT.afterEach()**  (if
87     set) functions.
88
89 * **_AFT.testEvtReceived(testName, eventName, timeout, setUp, tearDown)**
90
91     Prior to be able to check that an event has been received, you have to
92     register the event with the test framework using **_AFT.addEventToMonitor**
93     function.
94
95     Check if an event has been correctly received in time (timeout in µs). An event
96     name use the application framework naming scheme: **api/event_name**.
97
98 * **_AFT.testEvtNotReceived(testName, eventName, timeout, setUp, tearDown)**
99
100     Prior to be able to check that an event has not been received, you have to
101     register the event with the test framework using **_AFT.addEventToMonitor**
102     function.
103
104     Check if an event has not been correctly received in time (timeout in µs). An
105     event name use the application framework naming scheme: **api/event_name**.
106
107 * **_AFT.testGrpEvtReceived(testName, eventGrp, timeout, setUp, tearDown)**
108
109     Prior to be able to check that a group of event (a table of event) has been
110     received, you have to register the event with the test framework using
111     **_AFT.addEventToMonitor** function.
112
113     The table has to have this format:
114 ```lua
115     eventGrp = {["api/event_name_1"]=1,["api/event_name_2"]=2,["api/event_name_3"]=5}
116 ```
117     As you can see, in the table, event names are table keys and the value stored are
118     the number of time that the events have to be received.
119
120     Check if events has been correctly received in time (timeout in µs). An
121     event name use the application framework naming scheme: **api/event_name**.