CUI

Components / Developer tools

Test explorer

Test results as a tree of suites and tests, each with its status and time.

Functions: cui_test_explorer

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

OptionTypeDefaultDescription
.widthcui_sizeWidth: CUI_FILL, CUI_FIT, CUI_PX(n) or CUI_PCT(n); unset uses the component's own.
.heightfloat320default 320

cui_test_item

FieldTypeDescription
nameconst char *name of the suite or test; the toolbar's field filters by it
depthint0 for the top suites
statuscui_job_statusa suite's own status is ignored when it has tests
durationfloatseconds, negative when it has not run
messageconst 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

FieldTypeDescription
selectedintitems, or -1
activatedintitems, or -1
runintitem whose run button was pressed this frame, or -1
run_allboolthe Run all button was pressed this frame
passedinttests, not suites
failedinttests, not suites
skippedinttests, not suites
totalinttests, 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.