These rules apply to unit tests (gtest, UTEST) and functional tests (testsuite) when writing tests and reviewing them. For the tooling see Unit Tests and Benchmarks and Functional service tests (testsuite).
Structure the test as setup, act, assert.
New functionality and bug fixes must have tests.
A bug fix needs one test that fails without the fix. For flaky failures caused by production code rather than the test itself, first add a test that reliably reproduces the bug without flakiness, then fix the code.
Test behavior, not implementation: assert results observable through the public API, not internal calls.
If the bug cannot be reproduced through the public API, first look for the public scenario that triggers it and test that scenario. If there is none, test the internal component only if it has its own contract and tests; do not add a test that pins one internal code path.
Keep the test set minimal. Add another test only if it covers a distinct behavior of the change that no other new or existing test exercises. Tests of unrelated existing behavior belong to a separate change. When reviewing, request removal of tests that:
Each test checks one behavior, and its name states that behavior. A test that walks through the happy path of several behaviors is fine as long as every failure gives a clear message. Split a test that checks independent scenarios; a name that joins several of them signals this. A condition and its expected result describe one scenario and may both appear in the name. Add comments only when names and code structure cannot convey the behavior.
Before writing a test, find the closest existing test of the same component (for example, a failure test next to which the new one belongs) and put the new test next to it, reusing its fixtures and helpers. Do not construct objects under test with long positional argument lists; reuse or add a factory helper.