a4632d49a2fc0c890ffb8018e270f9084c3123a8
[src/app-framework-binder.git] / doc / afb-tests-overview.md
1 # Overview of tests shipped with AFB-Daemon
2     Version: 1
3     Date:    30 May 2016
4     Author:  Manuel Bachmann
5
6
7 ## List of tests
8   Here are the tests shipped in the source tree:
9  * **afb-client-demo** (command-line WebSockets)
10  * **token-websock.qml** (Qt/QML WebSockets)
11  * ***.html** (HTML5/JS HTTP-REST & WebSockets)
12
13
14 ## Detail of tests
15
16 ### afb-client-demo (command-line WebSockets)
17
18 This clients interactively calls plugins APIs from the command line, using the binder [WebSockets](https://en.wikipedia.org/wiki/WebSocket) facility.
19
20 If _afb-daemon_ has been launched with the following parameters:
21 ```
22 $ afb-daemon --port=1234 --token=123456 [...]
23 ```
24
25 Then run the client with :
26 ```
27 afb-client-demo ws://localhost:1234/api?token=123456 <plugin> <verb>
28 ```
29
30 For instance, to initialize the Audio plugin from the command line :
31 ```
32 afb-client-demo ws://localhost:1234/api?token=123456 auth connect
33 (copy-paste the "token" field from the response)
34 afb-client-demo ws://localhost:1234/api?token=123456 audio init <TOKEN>
35 ```
36
37 <br />
38
39
40
41 ### token-websock.qml (Qt/QML WebSockets)
42
43 If _afb-daemon_ has been launched with the following parameters:
44 ```
45 $ afb-daemon --port=1234 --token=123456 [...]
46 ```
47 and Qt5 is installed, on **Ubuntu 16.04**:
48 ```
49 $ apt-get install qmlscene qml-module-qtwebsockets qml-module-qtquick-controls
50 ```
51 or on **Fedora 23** :
52 ```
53 $ dnf install qt5-qtdeclarative-devel qt5-qtwebsockets-devel qt5-qtquickcontrols
54 ```
55
56 Then run the client with :
57 ```
58 qmlscene test/token-websock.qml
59 ```
60 and interactively press the buttons, "Connect", "Refresh", "Logout".
61
62 <br />
63
64
65 ### *.html (HTML5/JS HTTP-REST & WebSockets)
66
67 If _afb-daemon_ has been launched with the following parameters:
68 ```
69 $ afb-daemon --port=1234 --rootdir=$PWD/test [...]
70 ```
71 _("$PWD/test_" being the "test" subdirectory of the source tree)_
72
73
74 Then open your preferred Web browser, connect to the following URL:
75 ```
76 http://localhost:1234
77 ```
78 and interactively run the various tests.