CLion 2016.3 Help

Creating Tests Using Code Generate Menu

The Generate menu enables generating of standard test code constructs. You can generate a test stub using this menu; besides, depending on the current context CLion provides you with a list of Google Test specific constructs:

  • Test fixture.
  • SetUp method
  • TearDown method

To create test code constructs using the Generate menu:

  1. Open the test file and place the caret at the desired position in the editor.
  2. Do one of the following:
    • On the main menu, choose Code | Generate.
    • Right click the editor and choose Generate on the context menu.
    • Press Alt+Insert
  3. In the Generate menu that appears, select the desired construct.
    /help/img/idea/2016.3/cl_GenerateTest.png
    Important note: When generating tests for fixtures, once you have specify a fixture name in the created template, CLion automatically converts the inserted macro to one of the following types:
    • TEST_F()
    • TEST_P()
    • TYPED_TEST()
    • TYPED_TEST_P()

See Also

Last modified: 29 March 2017