Tests
A test is one entry in a suite's tests array.
It describes one situation through input and checks Bifröst's calculated
result through verify. The suite supplies the shared configuration and
environment facts.
Properties
name
The case's name, unique within its suite. Reports and CLI filters use
suite.name/test.name.
input
An object describing the request and assumed authentication outcomes for this case. It does not contain the expected result; assertions supply that.
verify
function(t, actual)
A Lua function receiving Test context as t and
Result as actual. Run at least one
t:IsEqual assertion. Its return value is ignored.
Example
This test uses the configuration and account facts from
the first-test guide. Define it before suite { ... }:
| Test definition | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Use tests = { selectedUser } in the suite, or add selectedUser, to its
existing tests array.
Execution
Each selected test starts with a fresh Lua VM and replays the suite declaration. Globals and captured local variables therefore do not carry state from a previous test. Write declarations that produce the same inputs on each replay.