Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
c4ed56eb
Commit
c4ed56eb
authored
Dec 15, 2020
by
Sebastian Krämer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add subsection for GTEST_SKIP documentation
A subsection "Skipping test execution" was added to document GTEST_SKIP and where it can be used. relates issue #1544
parent
8d664b94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
advanced.md
docs/advanced.md
+26
-0
No files found.
docs/advanced.md
View file @
c4ed56eb
...
...
@@ -527,6 +527,32 @@ destructor early, possibly leaving your object in a partially-constructed or
partially-destructed state! You almost certainly want to
`abort`
or use
`SetUp`
/
`TearDown`
instead.
## Skipping test execution
Related to pseudo assertions
`SUCCEED()`
and
`FAIL()`
you can prevent further test
execution with the
`GTEST_SKIP()`
macro.
`GTEST_SKIP`
can be used in test cases or in
`SetUp()`
methods of classes inherited
from either
`::testing::Environment`
or
`::testing::Test`
. The latter is a convenient
way to check for preconditions of the system under test during runtime and skip
the test in a meaningful way.
Based on googletest's own test code:
```
c++
class
Fixture
:
public
Test
{
protected
:
void
SetUp
()
override
{
GTEST_SKIP
()
<<
"skipping all tests for this fixture"
;
}
};
TEST_F
(
Fixture
,
SkipsOneTest
)
{
EXPECT_EQ
(
5
,
7
);
// won't fail, it won't get executed
}
```
The informational text is optional.
## Teaching googletest How to Print Your Values
When a test assertion such as
`EXPECT_EQ`
fails, googletest prints the argument
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment