I am having a set of .bat files . each file contains some tests. How can i disable one of the test ?
the following is an example
bashTester.sh
#! /bin/bash
bats -T --gather-test-outputs-in $OUTPUT/createEnvironment.bat
bats -T --gather-test-outputs-in $OUTPUT/protocolTest.bat
I want to ignore a test in the protocolTest.bat . The following are my tests in the protocolTest.bats
file.
protocolTest.bats
@test "test1-protocol" {
}
@test "test2-protocol" {
}
how can i ignore or disable the test "test2-protocol" ?
There are two ways to skip tests with BATS:
bats
Which solutions works best for you will depend on the context of your question.
skip
in the codeQuoting the "
skip
: Easily skip tests" section of the manual:To give you an example of all 3 of these:
This last option, using a condition, would also allow you to skip the test when a certain environmental variable is (or isn't) set, giving you more fine-grained control.
For instance, if the test code look like this:
and
bats
is called like this:the test will be skipped. Calling
bats
without settingSKIP_TEST
will run all test, without skipping anything.--filter
on runQuoting the the "Usage" section of the manual:
As the filter needs a match, we need to negate the test you want to exclude.
Given the example, something like this should work:
More information about negating regexes can be found on StackOverflow