Running unit tests remotely

Hi, I am trying to run unit tests (Googletest) remotely (inside a running local docker container). I am using the CMake open folder feature with the remote build capability of VS 2019. VS is incapable of finding the unit tests but Resharper Ultimate is! My idea was to modify the command executed to run the tests. It seems that there may be two possibilities:

1. Resharper executes a local script with the remote path and the name of the executable as arguments
2. Resharper directly executes a docker exec/ssh command directly with the same arguments as above to run the test executable on the remote machine

I tried achieving this by changing the Resharper Options->Unit testing-> Test Frameworks-> C++ tests entries.

If I just execute a unit test resharper runs:
command: [local build directory]/[test exe name]
workdir: [local build directory]

I changed the "Command" option and it worked for fixed commands. This way there would just be one global command which is pretty useless without the executable name. How can I add the test's executable name from visual studio's or CMake variables to the command?

2 comments
Comment actions Permalink

I would like to add that the project's directories are shared between the loacl and remote machines

0
Comment actions Permalink

Hello!

Sorry, this is not currently possible in CMake solutions, the tracking issue is https://youtrack.jetbrains.com/issue/RSCPP-25403. R++ should be able to deduce which local binary to run in a CMake solution for a given test, but this does not help in your case.

It might be possible to do what you want if you generate a VS project from CMake, then you can specify how to run unit tests per project using the debugging properties. It would still be rather complicated - R++ will expect your binary to behave like a normal executable with google tests, and it also makes use of the GTEST_FILTER environment variable, so you'll need to forward that too. 

0

Please sign in to leave a comment.