Components / Developer tools
Test explorer
Test results as a tree of suites and tests, each with its status and time.
Functions: cui_test_explorer

Usage
static const cui_test_item tests[] = {
{ "layout", 0 }, /* a suite: the items after it with a greater depth are its tests */
{ "wraps to the next line", 1, CUI_JOB_PASSED, 0.006f },
{ "mirrors under right to left", 1, CUI_JOB_FAILED, 0.012f, "expected x = 412, got 388" },
};
cui_test_explorer_result r = cui_test_explorer(ui, "tests", tests, 3);
if (r.run >= 0) run_tests_under(r.run);
if (r.run_all) run_everything();
Test results as a tree in tree order, each item with its depth. A suite shows a status summed from its tests (failed, then running, then pending), how many passed, and their total time. A test shows its own status and time, and a time over a second is shown in amber. A failure's first message line shows under it, and the whole message on hover. The toolbar has a Run all button, toggles that filter passed, failed and skipped tests and show their counts, and a field that filters by name. The run button shows on the hovered and the selected row. Up and Down move the selection. Left folds a suite or goes to the parent, Right unfolds, and Enter or a double click reports activated. The statuses are the pipeline's cui_job_status. Only the rows in view are built.
Keyboard
- Up and Down move the selection.
- Left folds a suite or goes to the parent, Right unfolds, and Enter or a double click reports
activated.
Options of cui_test_explorer
| Option | Type | Default | Description |
|---|---|---|---|
.width | cui_size | Width: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own. | |
.height | float | 320 | default 320 |
cui_test_item
| Field | Type | Description |
|---|---|---|
name | const char * | name of the suite or test; the toolbar's field filters by it |
depth | int | 0 for the top suites |
status | cui_job_status | a suite's own status is ignored when it has tests |
duration | float | seconds, negative when it has not run |
message | const char * | why it failed, may be NULL |
cui_job_status: CUI_JOB_PENDING, CUI_JOB_RUNNING, CUI_JOB_PASSED, CUI_JOB_FAILED, CUI_JOB_SKIPPED, CUI_JOB_CANCELED
cui_test_explorer_result
| Field | Type | Description |
|---|---|---|
selected | int | items, or -1 |
activated | int | items, or -1 |
run | int | item whose run button was pressed this frame, or -1 |
run_all | bool | the Run all button was pressed this frame |
passed | int | tests, not suites |
failed | int | tests, not suites |
skipped | int | tests, not suites |
total | int | tests, not suites |
Related
- Stack trace: An exception with its call stack.
- Regex tester: A pattern, its flags and a test text, with every match and group highlighted.
- HTTP request bar: The method, the URL and Send, as in an API client.
- Trace viewer: A tracing timeline in the manner of a performance panel.