Reputation: 4978
For running all the tests under a target I use the command line command
bazel test //src/code_path:target_name
What should be additional parameters to run a test single_test
from the above target?
Upvotes: 18
Views: 35074
Reputation: 5006
You'll want to use --test_filter
.
The specific format of the value to the flag depends on the test runner.
Upvotes: 3
Reputation: 5387
To give a specific example for the default C++ testrunner (not the general "depends on which test runner you use"):
For a test:
TEST_F(HiMomFixture, testCall)
{
EXPECT_EQ(..)
}
Select this with:
bazel test ... --test_filter HiMom*
or
bazel test ... --test_filter Hi*
Reference: ahumesky answer
Upvotes: 3
Reputation: 11
bazel test --test_output=streamed --test_filter='single_test' //src/code_path:target_name
Upvotes: 0
Reputation: 7986
--test_filter can be used:
For the following googletest test:
TEST(glog, log) {
LOG(INFO) << "an INFO log message";
VLOG(1) << "a vlog(1) message";
}
--test_filter=glog.log
can be used to pick it.
Upvotes: 6
Reputation: 306
On Googletest with the following setup:
TEST(TestSuite, test1)
TEST(TestSuite, test2)
you can isolate test1 using
bazel test --test_arg=--gtest_filter=TestSuite.test $TEST_TARGET_PATH
See --gtest_filter
Upvotes: 19