google / google/googletest

[Bug]: Skipped tests' messages are displayed in brief mode

Open
#4,548 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.5k
Forks
10.9k
Avg merge
6d 13h
Merged PRs (30d)
1

Description

### Describe the issue

When running tests using `--gtest_brief=1`, the messages produced by skipped tests are printed.

The help for `gtest_brief` suggests that only test _failures_ should be displayed:

```console
$ ./tests --help | grep gtest_brief -A1
--gtest_brief=1
Only print test failures.
```

I expected that the output from the skipped tests would be hidden.

### Steps to reproduce the problem

Add a skipped test and run the test using the `--gtest_brief=1` option.

For example:

```cpp
// test.cpp
#include

TEST(Test, TwoAndTwoIsFour) {
GTEST_SKIP();
EXPECT_EQ(2 + 2, 4);
}

TEST(Test, FiveAndFiveIsTen) {
GTEST_SKIP() << "user message";
EXPECT_EQ(5 + 5, 10);
}
```
Running this test outputs:

```console
$ ./test --gtest_brief=1
Running main() from /tmp/googletest-20230913-4615-1t6szd0/googletest-1.14.0/googletest/src/gtest_main.cc
/test.cpp:5: Skipped

/test.cpp:10: Skipped
user message

[==========] 2 tests from 1 test suite ran. (0 ms total)
[ PASSED ] 0 tests.
[ SKIPPED ] 2 tests.
```

### What version of GoogleTest are you using?

1.14.0

### What operating system and version are you using?

OSX

### What compiler and version are you using?

Apple clang version 15.0.0 (clang-1500.3.9.4)

### What build system are you using?

cmake version 3.29.2

### Additional context

I have a patch that resolves this issue. I'm happy to open a PR if you're open to the change.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the test.cpp example and the --gtest_brief=1 option, then inspect the brief-mode test reporting path. Add a regression test covering skipped tests with and without a message, and verify that brief mode displays failures while hiding skipped-test messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.