summaryrefslogtreecommitdiffstats
path: root/doc/afb-tests-overview.md
blob: d6f619fec5289a3678f93bbc91c9997af2428522 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.
Overview of tests shipped with AFB-Daemon
=========================================

List of tests
-------------

Here are the tests shipped in the source tree:

* **afb-client-demo** (command-line WebSockets)

* **token-websock.qml** (Qt/QML WebSockets)

* ***.html** (HTML5/JS HTTP-REST & WebSockets)


Detail of tests
---------------

### afb-client-demo (command-line WebSockets)

This clients interactively calls bindings APIs from the command line, using the binder
[WebSockets](https://en.wikipedia.org/wiki/WebSocket) facility.

If _afb-daemon_ has been launched with the following parameters:


    $ afb-daemon --port=1234 --token=123456 [...]


Then run the client with :

    afb-client-demo ws://localhost:1234/api?token=123456 [<api> <verb> [<json-data>]]

For instance, to initialize the Audio binding from the command line :

    afb-client-demo ws://localhost:1234/api?token=123456

The command doesn't return. You should type requests of type <api> <verb> [<json-data>].
So, try:

    auth connect
    hello pingjson true

<br />



### token-websock.qml (Qt/QML WebSockets)

If _afb-daemon_ has been launched with the following parameters:

    $ afb-daemon --port=1234 --token=123456 [...]

and Qt5 is installed.

For installing Qt5 on **Ubuntu 16.04**:

    $ apt-get install qmlscene qml-module-qtwebsockets qml-module-qtquick-controls

For installing Qt5 on **Fedora >= 22** :

    $ dnf install qt5-qtdeclarative-devel qt5-qtwebsockets-devel qt5-qtquickcontrols


Then run the client with :

    qmlscene test/token-websock.qml

and interactively press the buttons, "Connect", "Refresh", "Logout".

<br />


### *.html (HTML5/JS HTTP-REST & WebSockets)

If _afb-daemon_ has been launched with the following parameters:

    $ afb-daemon --port=1234 --rootdir=$PWD/test [...]

_("$PWD/test_" being the "test" subdirectory of the source tree)_


Then open your preferred Web browser, connect to the following URL:

    http://localhost:1234

and interactively run the various tests.