Basic Concepts
Basic Concepts
When using Google test, you start by writingAssertions, Which are statements that check whether a condition is true. An assertion's result can beSuccess,Nonfatal failure, OrFatal failure. If a fatal failure occurs, it aborts the current function; otherwise the program continues normally.
When usingGoogle testStarts when you write a statement to determine whether the test condition is true or not. The result of an assertion can be successful, non-fatal failure and fatal failure. If a fatal failure occurs, the test terminates the current function. OtherwiseProgramWill continue to run.
TestsUse assertions to verify the tested code's behavior. If a test crashes or has a failed assertion, then itFails; Otherwise itSucceeds.
Test Use assertions to ensure testCodeBehavior, if the testCrashOr the assertion fails. The test will fail. Otherwise, the test is successful.
ATest CaseContains one or deletests. you shoshould group your tests into test cases that reflect the structure of the tested code. when multiple tests in a test case need to share common objects and subroutines, you can put them intoTest FixtureClass.
One Test Case (Test case) contains one or more tests. You should combine your tests into a test case that reflects the test code structure. When multiple tests in a test case need to share objects and sub-processes, they should be placed in one Test Fixture Class.
ATest ProgramCan contain multiple test cases.
A test program can contain multiple test cases.
We'll now explain how to write a test program, starting at the individual assertion level and building up to tests and test cases.
We will describe how to write a test program and start to use independent asserted conditions and build tests and test cases.