Unit tests are not discovered

 I finally started trying to use Unit Tests under R++(2017.1.3) and VC 2017 Community and have had no luck getting the IDE to recognize tests. I have tried Google following your blog post instructions( I suspect that I need to build the libs myself since the gtest nuget pak seems to use old std headers), Boost( is Test from 1.64 not supported yet?) and Catch.

Because of the various issues I mentioned, I have only managed to build the version with Catch:

//Test.cpp

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

int theAnswer() { return 6 * 9; }

TEST_CASE("Life, the universe and everything", "[42][theAnswer]") {
REQUIRE(theAnswer() == 42);
}

 

Running this exe gets me output to the cmd window but nothing shows up in the UnitTest Explorer window or on the left in the text editor.

I have the "Enable Catch Support" as well as Boost and Google Test enabled under R#/Tools/Unit Testing/c++ Tests.

I am probably missing something obvious but, if so, I am obviously missing it.

Any clue as to what I have wrong?  TIA.

1 comment

Hello,

I can think of a couple (unlikely) problems:

1) Please check that "Unit Testing" is enabled in ReSharper | Options | Environment | Products & Features.

2) Please verify that you're using Catch from the master branch (i.e. Catch 1.x).

If this still fails, please create an issue in https://youtrack.jetbrains.com/issues?q=project:%20%7BReSharper%20C%2B%2B%7D  and attach a repro solution to it - we'll check if the problem is reproducible on our end.

Boost Test 1.64 should be supported.

With Google Test the easiest approach is to run the https://github.com/google/googletest/blob/master/googletest/scripts/fuse_gtest_files.py script to have all gtest source files fused into a single source file, and then to just include it into your test project.

Thanks!

0

Please sign in to leave a comment.