Googletest export

Add links to "sampleK_unittest.cc" examples. Fix some broken docs crosslinks.

PiperOrigin-RevId: 261169561
This commit is contained in:
Abseil Team
2019-08-01 15:04:08 -04:00
committed by Gennadiy Civil
parent da28d30191
commit 8756ef9058
6 changed files with 50 additions and 32 deletions

View File

@@ -399,7 +399,8 @@ and you're ready to go.
### More String Assertions
(Please read the [previous](#AssertThat) section first if you haven't.)
(Please read the [previous](#asserting-using-gmock-matchers) section first if
you haven't.)
You can use the gMock
[string matchers](../../googlemock/docs/cheat_sheet.md#string-matchers) with
@@ -1407,7 +1408,10 @@ Please note that `INSTANTIATE_TEST_SUITE_P` will instantiate *all* tests in the
given test suite, whether their definitions come before or *after* the
`INSTANTIATE_TEST_SUITE_P` statement.
You can see sample7_unittest.cc and sample8_unittest.cc for more examples.
You can see [sample7_unittest.cc] and [sample8_unittest.cc] for more examples.
[sample7_unittest.cc]: ../samples/sample7_unittest.cc "Parameterized Test example"
[sample8_unittest.cc]: ../samples/sample8_unittest.cc "Parameterized Test example with multiple parameters"
### Creating Value-Parameterized Abstract Tests
@@ -1446,7 +1450,7 @@ returns the value of `testing::PrintToString(GetParam())`. It does not work for
NOTE: test names must be non-empty, unique, and may only contain ASCII
alphanumeric characters. In particular, they
[should not contain underscores](https://github.com/google/googletest/blob/master/googletest/docs/faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore)
[should not contain underscores](faq.md#why-should-test-suite-names-and-test-names-not-contain-underscore)
```c++
class MyTestSuite : public testing::TestWithParam<int> {};
@@ -1555,7 +1559,9 @@ TYPED_TEST(FooTest, DoesBlah) {
TYPED_TEST(FooTest, HasPropertyA) { ... }
```
You can see sample6_unittest.cc
You can see [sample6_unittest.cc] for a complete example.
[sample6_unittest.cc]: ../samples/sample6_unittest.cc "Typed Test example"
## Type-Parameterized Tests
@@ -1630,7 +1636,7 @@ that type directly without `::testing::Types<...>`, like this:
INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, int);
```
You can see `sample6_unittest.cc` for a complete example.
You can see [sample6_unittest.cc] for a complete example.
## Testing Private Code
@@ -1998,7 +2004,9 @@ You can do so by adding one line:
```
Now, sit back and enjoy a completely different output from your tests. For more
details, you can read this sample9_unittest.cc
details, see [sample9_unittest.cc].
[sample9_unittest.cc]: ../samples/sample9_unittest.cc "Event listener example"
You may append more than one listener to the list. When an `On*Start()` or
`OnTestPartResult()` event is fired, the listeners will receive it in the order
@@ -2023,7 +2031,9 @@ handle `OnTestPartResult()` *before* listeners that can generate failures. This
ensures that failures generated by the latter are attributed to the right test
by the former.
We have a sample of failure-raising listener sample10_unittest.cc
See [sample10_unittest.cc] for an example of a failure-raising listener.
[sample10_unittest.cc]: ../samples/sample10_unittest.cc "Failure-raising listener example"
## Running Test Programs: Advanced Options

View File

@@ -263,7 +263,7 @@ If necessary, you can continue to derive test fixtures from a derived fixture.
googletest has no limit on how deep the hierarchy can be.
For a complete example using derived test fixtures, see
[googletest sample](https://github.com/google/googletest/blob/master/googletest/samples/sample5_unittest.cc)
[sample5_unittest.cc](../samples/sample5_unittest.cc).
## My compiler complains "void value not ignored as it ought to be." What does this mean?

View File

@@ -51,26 +51,34 @@ of misunderstanding these.
Historically, googletest started to use the term _Test Case_ for grouping
related tests, whereas current publications including the International Software
Testing Qualifications Board ([ISTQB](http://www.istqb.org/)) and various
textbooks on Software Quality use the term _[Test
Suite](http://glossary.istqb.org/search/test%20suite)_ for this.
textbooks on Software Quality use the term _[Test Suite][istqb test suite]_ for
this.
The related term _Test_, as it is used in the googletest, is corresponding to
the term _[Test Case](http://glossary.istqb.org/search/test%20case)_ of ISTQB
and others.
the term _[Test Case][istqb test case]_ of ISTQB and others.
The term _Test_ is commonly of broad enough sense, including ISTQB's definition
of _Test Case_, so it's not much of a problem here. But the term _Test Case_ as
was used in Google Test is of contradictory sense and thus confusing.
googletest recently started replacing the term _Test Case_ by _Test Suite_ The
preferred API is TestSuite*. The older TestCase* API is being slowly deprecated
and refactored away
googletest recently started replacing the term _Test Case_ with _Test Suite_.
The preferred API is *TestSuite*. The older TestCase API is being slowly
deprecated and refactored away.
So please be aware of the different definitions of the terms:
Meaning | googletest Term | [ISTQB](http://www.istqb.org/) Term
:----------------------------------------------------------------------------------- | :---------------------- | :----------------------------------
Exercise a particular program path with specific input values and verify the results | [TEST()](#simple-tests) | [Test Case](http://glossary.istqb.org/search/test%20case)
| Meaning | googletest Term | [ISTQB](http://www.istqb.org/) |
: : : Term :
| :---------------- | :---------------------- | :----------------------------- |
| Exercise a | [TEST()](#simple-tests) | [Test Case][istqb test case] |
: particular : : :
: program path with : : :
: specific input : : :
: values and verify : : :
: the results : : :
[istqb test case]: http://glossary.istqb.org/en/search/test%20case
[istqb test suite]: http://glossary.istqb.org/en/search/test%20suite
## Basic Concepts
@@ -235,9 +243,8 @@ of two wide strings fails, their values will be printed as UTF-8 narrow strings.
**Availability**: Linux, Windows, Mac.
**See also**: For more string comparison tricks (substring, prefix, suffix, and
regular expression matching, for example), see
[this](https://github.com/google/googletest/blob/master/googletest/docs/advanced.md)
in the Advanced googletest Guide.
regular expression matching, for example), see [this](advanced.md) in the
Advanced googletest Guide.
## Simple Tests