Bats Concepts

From NovaOrdis Knowledge Base
Revision as of 01:03, 2 October 2019 by Ovidiu (talk | contribs) (→‎Test)
Jump to navigation Jump to search

Internal

Test

Tests are executed in the order they're specified in the file.

@test "something" {

    run my-command status
    [[ ${status} -eq 0 ]]
    [[ ${output} =~ We[[:space:]]are[[:space:]]good ]]
}

Run a Command and Check the Status and Output

some_command=....
[...]
run ${some_command}
[[ ${status} -eq 0 ]]
[[ ${output} =~ .*Stack[[:space:]]test[[:space:]]is[[:space:]]stable[[:space:]]and[[:space:]]running* ]]

${output}

$(output) coalesce lines:

some_command=....
[...]
run ${some_command}
[[ ${output} =~ .*Stack[[:space:]]test[[:space:]]is[[:space:]]stable[[:space:]]and[[:space:]]running* ]]

${lines}

Setup/Teardown