Google test primer (Getting Started) (2) -- Basic Concepts

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.