Skip to content

Commit 55faf58

Browse files
authored
test: Add Readme to api-test app (#48)
1 parent 7b2a83c commit 55faf58

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
# firebolt-cpp-client
22
Implementation of Firebolt C++ Client.
3+
4+
## API Test App
5+
6+
For usage instructions of the API test application, see:
7+
8+
- [test/api_test_app/README.md](test/api_test_app/README.md)

test/api_test_app/README.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# API Test App
2+
3+
`api-test-app` is a CLI demo/test utility for exercising Firebolt C++ client APIs.
4+
It can connect to a local mock service, a platform service, or any endpoint set through an environment variable.
5+
It can be run in either interactive or auto mode.
6+
In interactive mode, the user can select which APIs to call via a menu system.
7+
In auto mode, every API method is called sequentially, with no input from the user.
8+
9+
All output is to stdout.
10+
11+
## Executable Name
12+
13+
The app binary name is:
14+
15+
`api-test-app`
16+
17+
## Command Line Usage
18+
19+
```bash
20+
api-test-app [--auto] [--mock] [--platform] [--dbg] [--help]
21+
```
22+
23+
### Options
24+
25+
- `--auto`
26+
Run all methods for all interfaces automatically.
27+
28+
- `--mock`
29+
Use local mock endpoint: `ws://127.0.0.1:9998/`.
30+
31+
- `--platform`
32+
Use platform endpoint: `ws://127.0.0.1:3474/`.
33+
34+
- `--dbg`
35+
Enable debug logging.
36+
37+
- `--help`
38+
Print usage and exit.
39+
40+
## Endpoint Selection Priority
41+
42+
The app chooses the WebSocket endpoint in this order:
43+
44+
1. `--mock` or `--platform` (if provided)
45+
2. `FIREBOLT_ENDPOINT` environment variable (if set)
46+
3. Default fallback: `ws://127.0.0.1:9998/`
47+
48+
At startup, the app prints the selected URL:
49+
50+
```text
51+
Using firebolt URL: <url>
52+
```
53+
54+
## Run Modes
55+
56+
### 1) Interactive mode (default when stdin is a TTY)
57+
58+
- Shows a menu of interfaces.
59+
- After selecting an interface, shows its methods.
60+
- Runs selected methods on demand.
61+
62+
### 2) Auto mode (`--auto`)
63+
64+
- Runs every method of every interface sequentially.
65+
- Prints each interface and method before execution.
66+
67+
### 3) Piped stdin mode (non-TTY stdin)
68+
69+
When input is piped in, the app automatically switches to autorun behavior for command processing and reads one method name per line.
70+
71+
Each line must match a method string exactly (for example, `Accessibility.highContrastUI`).
72+
If a method is unknown, it prints:
73+
74+
```text
75+
Method not found: <input>
76+
```
77+
78+
## Examples
79+
80+
### Use mock service (default behavior in helper script)
81+
82+
```bash
83+
api-test-app --mock
84+
```
85+
86+
### Connect to platform service with debug logs
87+
88+
```bash
89+
api-test-app --platform --dbg
90+
```
91+
92+
### Use custom endpoint via environment
93+
94+
```bash
95+
export FIREBOLT_ENDPOINT="ws://192.168.1.50:3474/"
96+
api-test-app
97+
```
98+
99+
### Run all methods automatically
100+
101+
```bash
102+
api-test-app --auto --mock
103+
```
104+
105+
### Run methods from a test suite file
106+
107+
```bash
108+
cat test-suite.example | api-test-app --mock
109+
```
110+
111+
## Connection Behavior
112+
113+
- The app attempts to connect and waits up to 2 seconds for initial connection.
114+
- It exits with non-zero status if connection setup fails or times out.
115+
- On completion, it disconnects cleanly.
116+
117+
## Build Script Notes
118+
119+
The local helper script `build.sh` in this directory:
120+
121+
- Builds the app in `build/`
122+
- Runs `build/api-test-app --mock` by default
123+
- Supports options such as `--clean`, `--no-run`, `--just-run`, and `--sysroot`

0 commit comments

Comments
 (0)