Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Using Google Test with QtCreator and AutoTest plugin

Using Google Test with QtCreator and AutoTest plugin

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 9.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dmitry Zotikov
    wrote on last edited by
    #1

    Unit tests don't seem to run, although recognized by QtCreator.

    Here's the full story:

    I followed the manual describing how to use Google Test framework in QtCreator with AutoTest plugin, and wrote several simple unit tests for my project (the project itself is roughly equivalent to the default "Qt Widget Application"). Currently:

    • there's a Google Test 1.7 release sources residing in the project's root directory
    • project.pro contains these lines
    INCLUDEPATH += gtest/include gtest
    SOURCES += gtest/src/gtest-all.cc tests/project_unittest.cc
    
    • tests/project_unittest.cc contains
    #include "gtest/gtest.h"
    #include "Point.h"
    
    TEST(PointOps, ScalarMagnification) {
      Point p = {-4, 3, 1};
      double r = 3.5;
      Point result = {-14, 10.5, 3.5};
      EXPECT_EQ(p * r, result);
      EXPECT_EQ(r * p, result);
    }
    
    TEST(PointOps, UnitaryMinus) {
      Point p = {-4, 3, 0};
      Point result = {4, -3, 0};
      EXPECT_EQ(-p, result);
    }
    

    I can see the tests in the "Tests" pane, but when I run them the project's main() gets executed instead and the "Test Results" pane shows "Test summary: 0 passes, 0 fails".

    1 Reply Last reply
    0
    • Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @Dmitry-Zotikov you may want to take a look at this web training session

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      D 1 Reply Last reply
      0
      • Pablo J. RoginaP Pablo J. Rogina

        @Dmitry-Zotikov you may want to take a look at this web training session

        D Offline
        D Offline
        Dmitry Zotikov
        wrote on last edited by
        #3

        @Pablo-J.-Rogina thanks! I'll take a look.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved