Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Snippets GoogleTestNew to Visual Studio Code? Get it now.
Snippets GoogleTest

Snippets GoogleTest

mensebdev

|
1 install
| (0) | Free
GoogleTest snippets for VS Code.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info
logo

snippets-gtest

Collection of C++ code snippets for Google Test in VS Code.


VS Code Marketplace License

Table of contents

  • Installation
  • Naming Conventions
    • Base
    • Categories
    • Names
  • Usage
  • Snippets Overview
    • Asserts
    • Controls
    • Expects
    • Macros
  • Snippets Details
    • Asserts
    • Controls
    • Expects
    • Macros

Installation

You can install this extension from the Visual Studio Marketplace.

You can install directly via VS Code:

  1. Open the Extensions view.
  2. Search for snippets-gtest.
  3. Click Install on the Snippets GoogleTest extension.

Naming Conventions

All snippet prefixes in this extension follow a consistent pattern to make them easy to remember.

Base

All snippets start with: gt (short for Google Test).

Categories

After gt, add one letter to choose the snippet category:

Letter Category
a Asserts
e Expects
m Macros
c Controls

Example:

  • gta... → ASSERT snippets
  • gte... → EXPECT snippets

Names

After the category letter, the rest of the prefix matches the Google Test function name.

For single-word names, repeat the word, e.g.:

  • ASSERT_TRUE → gtaTRUE
  • EXPECTT_THAT → gteTHAT

For multi-word names, use the capitalized initials, e.g.:

  • ASSERT_GT → gtaGT
  • EXPECT_PRED_FORMAT1 → gtePF1

This makes it easy to find snippets by partially typing their Google Test name.

Usage

Type the snippet prefix and press Enter or Tab or select it from the IntelliSense menu.

Example:
The prefix gtaTRUE would expand to:

ASSERT_TRUE(condition);

Snippets Overview

Here is the overview of the list of snippets included in this collection.

Asserts

Prefix Description
gtaTHAT Checks that value matches the matcher matcher.
gtaTRUE Checks that condition is true.
gtaFALSE Checks that condition is false.
gtaEQ Checks that val1 == val2.
gtaNE Checks that val1 != val2.
gtaLT Checks that val1 < val2.
gtaLE Checks that val1 <= val2.
gtaGT Checks that val1 > val2.
gtaGE Checks that val1 >= val2.
gtaSTREQ Checks that the C-strings str1 and str2 are equal.
gtaSTRNE Checks that the C-strings str1 and str2 are not equal.
gtaSTRCASEEQ Checks that the C-strings str1 and str2 are equal, ignoring case.
gtaSTRCASENE Checks that the C-strings str1 and str2 are not equal, ignoring case.
gtaFEQ Checks that the floats val1 and val2 are almost equal.
gtaDEQ Checks that the doubles val1 and val2 are almost equal.
gtaNEAR Checks that \|val1 - val2\| <= abs_error.
gtaTHROW Checks that statement throws an exception of type exception_type.
gtaANYTHROW Checks that statement throws any exception.
gtaNOTHROW Checks that statement does not throw any exception.
gtaP1 Checks the unary predicate pred on v1.
gtaP2 Checks the binary predicate pred on v1, v2.
gtaP3 Checks the ternary predicate pred on v1, v2, v3.
gtaP4 Checks the 4-ary predicate pred on v1, v2, v3, v4.
gtaP5 Checks the 5-ary predicate pred on v1, v2, v3, v4, v5.
gtaPF1 Checks the user-defined formatter fmt for v1.
gtaPF2 Checks the user-defined formatter fmt for v1, v2.
gtaPF3 Checks the user-defined formatter fmt for v1, v2, v3.
gtaPF4 Checks the user-defined formatter fmt for v1, v2, v3, v4.
gtaPF5 Checks the user-defined formatter fmt for v1, v2, v3, v4, v5.
gtaHS Checks that the HRESULT expr indicates success (SUCCEEDED).
gtaHF Checks that the HRESULT expr indicates failure (FAILED).
gtaDEATH Checks that statement causes the process to die and its stderr matches regex.
gtaDIS Checks death as in ASSERT_DEATH, but skips on unsupported platforms.
gtaDDEATH Checks death only in debug mode; behaves like ASSERT_DEATH otherwise.
gtaEXIT Checks that statement exits and that predicate and regex match its exit code and output.

Controls

Prefix Description
gtcSUCCEED Explicitly signals that the current test has succeeded.
gtcFAIL Generates a fatal failure and aborts the current test immediately.
gtcAF Records a non-fatal failure at the current source location.
gtcAFA Records a non-fatal failure at the specified file and line.

Expects

Prefix Description
gteTHAT Checks that value matches matcher.
gteTRUE Checks that condition is true.
gteFALSE Checks that condition is false.
gteEQ Checks that val1 == val2.
gteNE Checks that val1 != val2.
gteLT Checks that val1 < val2.
gteLE Checks that val1 <= val2.
gteGT Checks that val1 > val2.
gteGE Checks that val1 >= val2.
gteSTREQ Checks that C-strings str1 and str2 are equal.
gteSTRNE Checks that C-strings str1 and str2 are not equal.
gteSTRCASEEQ Checks that C-strings str1 and str2 are equal, ignoring case.
gteSTRCASENE Checks that C-strings str1 and str2 are not equal, ignoring case.
gteFEQ Checks that floats val1 and val2 are almost equal.
gteDEQ Checks that doubles val1 and val2 are almost equal.
gteNEAR Checks that \|val1 - val2\| <= abs_error.
gteTHROW Checks that statement throws an exception of type exception_type.
gteANYTHROW Checks that statement throws any exception.
gteNOTHROW Checks that statement does not throw any exception.
gteP1 Checks unary predicate pred on v1.
gteP2 Checks binary predicate pred on v1, v2.
gteP3 Checks ternary predicate pred on v1, v2, v3.
gteP4 Checks 4-ary predicate pred on v1, v2, v3, v4.
gteP5 Checks 5-ary predicate pred on v1, v2, v3, v4, v5.
gtePF1 Checks user-defined formatter fmt for v1.
gtePF2 Checks user-defined formatter fmt for v1, v2.
gtePF3 Checks user-defined formatter fmt for v1, v2, v3.
gtePF4 Checks user-defined formatter fmt for v1, v2, v3, v4.
gtePF5 Checks user-defined formatter fmt for v1, v2, v3, v4, v5.
gteHS Checks that HRESULT expr indicates success (SUCCEEDED).
gteHF Checks that HRESULT expr indicates failure (FAILED).
gteDEATH Checks that statement causes the process to die and stderr matches regex.
gteDIS Checks death as in EXPECT_DEATH, but skips on unsupported platforms.
gteDDEATH Checks death only in debug mode; behaves like EXPECT_DEATH otherwise.
gteEXIT Checks that statement exits and that predicate and regex match its exit code and output.

Macros

Prefix Description
gtmTEST Defines a regular test case named TestName in the test suite TestSuiteName.
gtmTF Defines a test named TestName that uses the fixture TestFixtureName.
gtmTP Defines a parameterized test named TestName in the fixture TestFixtureName.
gtmITSP Instantiates the parameterized test suite TestSuiteName with the given param_generator under the instantiation name InstantiationName.
gtmITSPg Instantiates the parameterized test suite TestSuiteName with a custom NameGenerator to control test name suffixes.
gtmGAUPT Allows declaration of a parameterized test suite TestSuiteName without instantiation.
gtmTT Defines and runs a typed test TestName in the typed test suite TestSuiteName.
gtmTTS Defines a typed test suite TestFixtureName parameterized by Types.
gtmTTSg Defines a typed test suite TestFixtureName parameterized by Types, using NameGenerator to customize test name suffixes.
gtmTTSP Registers a typed test suite pattern TestFixtureName for later instantiation.
gtmTTP Defines a typed test pattern TestName for the typed test suite TestSuiteName.
gtmRTSP Registers one or more typed test names (TestName1, TestName2, …) with the typed test suite pattern TestSuiteName.
gtmITTSP Instantiates the typed test suite pattern TestSuiteName with the list of Types under the name InstantiationName.
gtmFT Declares TestName in TestSuiteName as a friend of its fixture class to grant access to private members.
gtmST Inserts a trace message that will be printed if a failure occurs in the current scope.
gtmGS Skips the remainder of the current test at runtime.
gtmMM Defines a mock method method_name with return type return_type and arguments args.
gtmMMs Defines a mock method method_name with return type return_type, arguments args, and qualifiers specs.
gtmEC Creates an expectation that the method method_name(matchers) will be called on mock_object.
gtmOC Specifies default behavior action for calls to method_name(matchers) on mock_object.

Snippets Details

Here is the detailed list of snippets included in this collection. They are represented with their tab stops. The last tab stop being the $0 at the end of the line.

Asserts


Prefix: gtaTHAT
Description: Checks that value matches the matcher matcher.
Output:

ASSERT_THAT(${1:value}, ${2:matcher});$0

Prefix: gtaTRUE
Description: Checks that condition is true.
Output:

ASSERT_TRUE(${1:condition});$0

Prefix: gtaFALSE
Description: Checks that condition is false.
Output:

ASSERT_FALSE(${1:condition});$0

Prefix: gtaEQ
Description: Checks that val1 == val2.
Output:

ASSERT_EQ(${1:val1}, ${2:val2});$0

Prefix: gtaNE
Description: Checks that val1 != val2.
Output:

ASSERT_NE(${1:val1}, ${2:val2});$0

Prefix: gtaLT
Description: Checks that val1 < val2.
Output:

ASSERT_LT(${1:val1}, ${2:val2});$0

Prefix: gtaLE
Description: Checks that val1 <= val2.
Output:

ASSERT_LE(${1:val1}, ${2:val2});$0

Prefix: gtaGT
Description: Checks that val1 > val2.
Output:

ASSERT_GT(${1:val1}, ${2:val2});$0

Prefix: gtaGE
Description: Checks that val1 >= val2.
Output:

ASSERT_GE(${1:val1}, ${2:val2});$0

Prefix: gtaSTREQ
Description: Checks that the C-strings str1 and str2 are equal.
Output:

ASSERT_STREQ(${1:str1}, ${2:str2});$0

Prefix: gtaSTRNE
Description: Checks that the C-strings str1 and str2 are not equal.
Output:

ASSERT_STRNE(${1:str1}, ${2:str2});$0

Prefix: gtaSTRCASEEQ
Description: Checks that the C-strings str1 and str2 are equal, ignoring case.
Output:

ASSERT_STRCASEEQ(${1:str1}, ${2:str2});$0

Prefix: gtaSTRCASENE
Description: Checks that the C-strings str1 and str2 are not equal, ignoring case.
Output:

ASSERT_STRCASENE(${1:str1}, ${2:str2});$0

Prefix: gtaFEQ
Description: Checks that the floats val1 and val2 are almost equal.
Output:

ASSERT_FLOAT_EQ(${1:val1}, ${2:val2});$0

Prefix: gtaDEQ
Description: Checks that the doubles val1 and val2 are almost equal.
Output:

ASSERT_DOUBLE_EQ(${1:val1}, ${2:val2});$0

Prefix: gtaNEAR
Description: Checks that |val1 - val2| <= abs_error.
Output:

ASSERT_NEAR(${1:val1}, ${2:val2}, ${3:abs_error});$0

Prefix: gtaTHROW
Description: Checks that statement throws an exception of type exception_type.
Output:

ASSERT_THROW(${1:statement}, ${2:exception_type});$0

Prefix: gtaANYTHROW
Description: Checks that statement throws any exception.
Output:

ASSERT_ANY_THROW(${1:statement});$0

Prefix: gtaNOTHROW
Description: Checks that statement does not throw any exception.
Output:

ASSERT_NO_THROW(${1:statement});$0

Prefix: gtaP1
Description: Checks the unary predicate pred on v1.
Output:

ASSERT_PRED1(${1:pred}, ${2:v1});$0

Prefix: gtaP2
Description: Checks the binary predicate pred on v1, v2.
Output:

ASSERT_PRED2(${1:pred}, ${2:v1}, ${3:v2});$0

Prefix: gtaP3
Description: Checks the ternary predicate pred on v1, v2, v3.
Output:

ASSERT_PRED3(${1:pred}, ${2:v1}, ${3:v2}, ${4:v3});$0

Prefix: gtaP4
Description: Checks the 4-ary predicate pred on v1, v2, v3, v4.
Output:

ASSERT_PRED4(${1:pred}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4});$0

Prefix: gtaP5
Description: Checks the 5-ary predicate pred on v1, v2, v3, v4, v5.
Output:

ASSERT_PRED5(${1:pred}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4}, ${6:v5});$0

Prefix: gtaPF1
Description: Checks the user-defined formatter fmt for v1.
Output:

ASSERT_PRED_FORMAT1(${1:fmt}, ${2:v1});$0

Prefix: gtaPF2
Description: Checks the user-defined formatter fmt for v1, v2.
Output:

ASSERT_PRED_FORMAT2(${1:fmt}, ${2:v1}, ${3:v2});$0

Prefix: gtaPF3
Description: Checks the user-defined formatter fmt for v1, v2, v3.
Output:

ASSERT_PRED_FORMAT3(${1:fmt}, ${2:v1}, ${3:v2}, ${4:v3});$0

Prefix: gtaPF4
Description: Checks the user-defined formatter fmt for v1, v2, v3, v4.
Output:

ASSERT_PRED_FORMAT4(${1:fmt}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4});$0

Prefix: gtaPF5
Description: Checks the user-defined formatter fmt for v1, v2, v3, v4, v5.
Output:

ASSERT_PRED_FORMAT5(${1:fmt}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4}, ${6:v5});$0

Prefix: gtaHS
Description: Checks that the HRESULT expr indicates success (SUCCEEDED).
Output:

ASSERT_HRESULT_SUCCEEDED(${1:expr});$0

Prefix: gtaHF
Description: Checks that the HRESULT expr indicates failure (FAILED).
Output:

ASSERT_HRESULT_FAILED(${1:expr});$0

Prefix: gtaDEATH
Description: Checks that statement causes the process to die and its stderr matches regex.
Output:

ASSERT_DEATH(${1:statement}, ${2:regex});$0

Prefix: gtaDIS
Description: Checks death as in ASSERT_DEATH, but skips on unsupported platforms.
Output:

ASSERT_DEATH_IF_SUPPORTED(${1:statement}, ${2:regex});$0

Prefix: gtaDDEATH
Description: Checks death only in debug mode; behaves like ASSERT_DEATH otherwise.
Output:

ASSERT_DEBUG_DEATH(${1:statement}, ${2:regex});$0

Prefix: gtaEXIT
Description: Checks that statement exits and that predicate and regex match its exit code and output.
Output:

ASSERT_EXIT(${1:statement}, ${2:predicate}, ${3:regex});$0

Controls


Prefix: gtcSUCCEED
Description: Explicitly signals that the current test has succeeded.
Output:

SUCCEED();$0

Prefix: gtcFAIL
Description: Generates a fatal failure and aborts the current test immediately.
Output:

FAIL();$0

Prefix: gtcAF
Description: Records a non-fatal failure at the current source location.
Output:

ADD_FAILURE();$0

Prefix: gtcAFA
Description: Records a non-fatal failure at the specified file and line.
Output:

ADD_FAILURE_AT(${1:file}, ${2:line});$0

Expects


Prefix: gteTHAT
Description: Checks that value matches matcher.
Output:

EXPECT_THAT(${1:value}, ${2:matcher});$0

Prefix: gteTRUE
Description: Checks that condition is true.
Output:

EXPECT_TRUE(${1:condition});$0

Prefix: gteFALSE
Description: Checks that condition is false.
Output:

EXPECT_FALSE(${1:condition});$0

Prefix: gteEQ
Description: Checks that val1 == val2.
Output:

EXPECT_EQ(${1:val1}, ${2:val2});$0

Prefix: gteNE
Description: Checks that val1 != val2.
Output:

EXPECT_NE(${1:val1}, ${2:val2});$0

Prefix: gteLT
Description: Checks that val1 < val2.
Output:

EXPECT_LT(${1:val1}, ${2:val2});$0

Prefix: gteLE
Description: Checks that val1 <= val2.
Output:

EXPECT_LE(${1:val1}, ${2:val2});$0

Prefix: gteGT
Description: Checks that val1 > val2.
Output:

EXPECT_GT(${1:val1}, ${2:val2});$0

Prefix: gteGE
Description: Checks that val1 >= val2.
Output:

EXPECT_GE(${1:val1}, ${2:val2});$0

Prefix: gteSTREQ
Description: Checks that C-strings str1 and str2 are equal.
Output:

EXPECT_STREQ(${1:str1}, ${2:str2});$0

Prefix: gteSTRNE
Description: Checks that C-strings str1 and str2 are not equal.
Output:

EXPECT_STRNE(${1:str1}, ${2:str2});$0

Prefix: gteSTRCASEEQ
Description: Checks that C-strings str1 and str2 are equal, ignoring case.
Output:

EXPECT_STRCASEEQ(${1:str1}, ${2:str2});$0

Prefix: gteSTRCASENE
Description: Checks that C-strings str1 and str2 are not equal, ignoring case.
Output:

EXPECT_STRCASENE(${1:str1}, ${2:str2});$0

Prefix: gteFEQ
Description: Checks that floats val1 and val2 are almost equal.
Output:

EXPECT_FLOAT_EQ(${1:val1}, ${2:val2});$0

Prefix: gteDEQ
Description: Checks that doubles val1 and val2 are almost equal.
Output:

EXPECT_DOUBLE_EQ(${1:val1}, ${2:val2});$0

Prefix: gteNEAR
Description: Checks that |val1 - val2| <= abs_error.
Output:

EXPECT_NEAR(${1:val1}, ${2:val2}, ${3:abs_error});$0

Prefix: gteTHROW
Description: Checks that statement throws an exception of type exception_type.
Output:

EXPECT_THROW(${1:statement}, ${2:exception_type});$0

Prefix: gteANYTHROW
Description: Checks that statement throws any exception.
Output:

EXPECT_ANY_THROW(${1:statement});$0

Prefix: gteNOTHROW
Description: Checks that statement does not throw any exception.
Output:

EXPECT_NO_THROW(${1:statement});$0

Prefix: gteP1
Description: Checks unary predicate pred on v1.
Output:

EXPECT_PRED1(${1:pred}, ${2:v1});$0

Prefix: gteP2
Description: Checks binary predicate pred on v1, v2.
Output:

EXPECT_PRED2(${1:pred}, ${2:v1}, ${3:v2});$0

Prefix: gteP3
Description: Checks ternary predicate pred on v1, v2, v3.
Output:

EXPECT_PRED3(${1:pred}, ${2:v1}, ${3:v2}, ${4:v3});$0

Prefix: gteP4
Description: Checks 4-ary predicate pred on v1, v2, v3, v4.
Output:

EXPECT_PRED4(${1:pred}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4});$0

Prefix: gteP5
Description: Checks 5-ary predicate pred on v1, v2, v3, v4, v5.
Output:

EXPECT_PRED5(${1:pred}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4}, ${6:v5});$0

Prefix: gtePF1
Description: Checks user-defined formatter fmt for v1.
Output:

EXPECT_PRED_FORMAT1(${1:fmt}, ${2:v1});$0

Prefix: gtePF2
Description: Checks user-defined formatter fmt for v1, v2.
Output:

EXPECT_PRED_FORMAT2(${1:fmt}, ${2:v1}, ${3:v2});$0

Prefix: gtePF3
Description: Checks user-defined formatter fmt for v1, v2, v3.
Output:

EXPECT_PRED_FORMAT3(${1:fmt}, ${2:v1}, ${3:v2}, ${4:v3});$0

Prefix: gtePF4
Description: Checks user-defined formatter fmt for v1, v2, v3, v4.
Output:

EXPECT_PRED_FORMAT4(${1:fmt}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4});$0

Prefix: gtePF5
Description: Checks user-defined formatter fmt for v1, v2, v3, v4, v5.
Output:

EXPECT_PRED_FORMAT5(${1:fmt}, ${2:v1}, ${3:v2}, ${4:v3}, ${5:v4}, ${6:v5});$0

Prefix: gteHS
Description: Checks that HRESULT expr indicates success (SUCCEEDED).
Output:

EXPECT_HRESULT_SUCCEEDED(${1:expr});$0

Prefix: gteHF
Description: Checks that HRESULT expr indicates failure (FAILED).
Output:

EXPECT_HRESULT_FAILED(${1:expr});$0

Prefix: gteDEATH
Description: Checks that statement causes the process to die and stderr matches regex.
Output:

EXPECT_DEATH(${1:statement}, ${2:regex});$0

Prefix: gteDIS
Description: Checks death as in EXPECT_DEATH, but skips on unsupported platforms.
Output:

EXPECT_DEATH_IF_SUPPORTED(${1:statement}, ${2:regex});$0

Prefix: gteDDEATH
Description: Checks death only in debug mode; behaves like EXPECT_DEATH otherwise.
Output:

EXPECT_DEBUG_DEATH(${1:statement}, ${2:regex});$0

Prefix: gteEXIT
Description: Checks that statement exits and that predicate and regex match its exit code and output.
Output:

EXPECT_EXIT(${1:statement}, ${2:predicate}, ${3:regex});$0

Macros


Prefix: gtmTEST
Description: Defines a regular test case named TestName in the test suite TestSuiteName.
Output:

TEST(${1:TestSuiteName}, ${2:TestName});$0

Prefix: gtmTF
Description: Defines a test named TestName that uses the fixture TestFixtureName.
Output:

TEST_F(${1:TestFixtureName}, ${2:TestName});$0

Prefix: gtmTP
Description: Defines a parameterized test named TestName in the fixture TestFixtureName.
Output:

TEST_P(${1:TestFixtureName}, ${2:TestName});$0

Prefix: gtmITSP
Description: Instantiates the parameterized test suite TestSuiteName with the given param_generator under the instantiation name InstantiationName.
Output:

INSTANTIATE_TEST_SUITE_P(${1:InstantiationName}, ${2:TestSuiteName}, ${3:param_generator});$0

Prefix: gtmITSPg
Description: Instantiates the parameterized test suite TestSuiteName with a custom NameGenerator to control test name suffixes.
Output:

INSTANTIATE_TEST_SUITE_P(${1:InstantiationName}, ${2:TestSuiteName}, ${3:param_generator}, ${4:NameGenerator});$0

Prefix: gtmGAUPT
Description: Allows declaration of a parameterized test suite TestSuiteName without instantiation.
Output:

GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(${1:TestSuiteName});$0

Prefix: gtmTT
Description: Defines and runs a typed test TestName in the typed test suite TestSuiteName.
Output:

TYPED_TEST(${1:TestSuiteName}, ${2:TestName});$0

Prefix: gtmTTS
Description: Defines a typed test suite TestFixtureName parameterized by Types.
Output:

TYPED_TEST_SUITE(${1:TestFixtureName}, ${2:Types});$0

Prefix: gtmTTSg
Description: Defines a typed test suite TestFixtureName parameterized by Types, using NameGenerator to customize test name suffixes.
Output:

TYPED_TEST_SUITE(${1:TestFixtureName}, ${2:Types}, ${3:NameGenerator});$0

Prefix: gtmTTSP
Description: Registers a typed test suite pattern TestFixtureName for later instantiation.
Output:

TYPED_TEST_SUITE_P(${1:TestFixtureName});$0

Prefix: gtmTTP
Description: Defines a typed test pattern TestName for the typed test suite TestSuiteName.
Output:

TYPED_TEST_P(${1:TestSuiteName}, ${2:TestName});$0

Prefix: gtmRTSP
Description: Registers one or more typed test names (TestName1, TestName2, …) with the typed test suite pattern TestSuiteName.
Output:

REGISTER_TYPED_TEST_SUITE_P(${1:TestSuiteName}, ${2:TestName1}${3:, ${4:TestName2}});$0

Prefix: gtmITTSP
Description: Instantiates the typed test suite pattern TestSuiteName with the list of Types under the name InstantiationName.
Output:

INSTANTIATE_TYPED_TEST_SUITE_P(${1:InstantiationName}, ${2:TestSuiteName}, ${3:Types});$0

Prefix: gtmFT
Description: Declares TestName in TestSuiteName as a friend of its fixture class to grant access to private members.
Output:

FRIEND_TEST(${1:TestSuiteName}, ${2:TestName});$0

Prefix: gtmST
Description: Inserts a trace message that will be printed if a failure occurs in the current scope.
Output:

SCOPED_TRACE(${1:message});$0

Prefix: gtmGS
Description: Skips the remainder of the current test at runtime.
Output:

GTEST_SKIP();$0

Prefix: gtmMM
Description: Defines a mock method method_name with return type return_type and arguments args.
Output:

MOCK_METHOD(${1:return_type}, ${2:method_name}, (${3:args}));$0

Prefix: gtmMMs
Description: Defines a mock method method_name with return type return_type, arguments args, and qualifiers specs.
Output:

MOCK_METHOD(${1:return_type}, ${2:method_name}, (${3:args}), (${4:specs}));$0

Prefix: gtmEC
Description: Creates an expectation that the method method_name(matchers) will be called on mock_object.
Output:

EXPECT_CALL(${1:mock_object}, ${2:method_name}(${3:matchers}))$0

Prefix: gtmOC
Description: Specifies default behavior action for calls to method_name(matchers) on mock_object.
Output:

ON_CALL(${1:mock_object}, ${2:method_name}(${3:matchers}))$4.WillByDefault(${5:action});$0

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft