Googleテストを作成する

Googleテストを作成するには:

  1. File >New Project >Test Project に移動します。
  2. Google Test Project 」>「Choose 」を選択し、Googleテスト用の定型コードを含むプロジェクトを作成します。
  3. Project and Test Information 」ダイアログで、プロジェクトとテストの設定を指定します。

    Google Test プロジェクトウィザードの「プロジェクトとテストの情報」ダイアログ

    1. Test framework 」で、「Google Test (shared libraries) 」を選択して Google Test をリンクするか、「Google Test (headers only) 」を選択して必要な Google Test ソースをプロジェクトに含めます。
    2. Test suite name 」で、テストスイートの名前を入力します。
    3. Test case name 」で、テストケースの名前を入力します。
    4. 共有ライブラリのテストの場合は、Googletest install directory (optional) で Google C++ テストフレームワークのインストール先へのパスを設定できます。
    5. ヘッダーのみのテストの場合は、[Googletest source directory (optional)] で googletest リポジトリのクローンへのパスを設定できます。
    6. Build system で、プロジェクトのビルドに使用するビルドシステム(CMake、qmake、または Qbs)を選択します。

Qt Creator これにより、指定されたプロジェクトディレクトリにテストが作成されます。

Google テストの作成に関する詳細については、『Google Test Primer』を参照してください。

注: テストのスキャン中 、パーサーはgtest/gtest.h を直接または間接的にインクルードしているファイルのみを考慮します。現時点でビルドされないファイルは無視されます。

「ハウツー:テスト」、「ビルドシステムの選択」、「テストも参照してください

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.