Visual Studio Test Adapter for Catch2: unit tests for C++ code on remote linux

189 views Asked by At

I want to use the Catch2 for unit testing in VS solution, containing projects written in C++ for Linux. Unfortunately, I can't make it working. The Visual Studio is running on MS Windows.

The problem: Visual Studio is not able to find/run the Catch2 unit tests on remote linux VM.

Steps done:

  1. I have C++ project (console app for linux), properly configured - it compiles on remote VM succesfuly, I'm able to run, debug, etc (from Visual Studio and from CLI on remote too).
  2. I added another C++ project (console app for linux) dedicated for unit tests. The project contains Catch2 sources (catch2_amalgamated.cpp and .hpp). I created few .cpp files containing simple Catch2 unit tests. The project compiles ok using VS on remote VM - no errors. I'm able to run the test executable from a CLI on linux - it works, prints expected data, test results, statuses etc.
  3. I installed Test Adapter for Catch2 from Visual Studio Marketplace, and configured it in created catch2.runsettings file (in the solution directory), containing entries suggested by the adapter author on his GitHub repository and by Microsoft (link: using Test Adapter for Catch2).
    Note: I have (positive) experience with this adapter and it's configuration: I've used this before in some Windows console projects (compiling and running on local machine) with success.
  4. I configured my Visual Studio for remote tests (link: VS configuration for remote testing).
  5. Unfortunately, the Visual Studio is not able to find/run tests. After opening Test Explorer, the exception is shown: System.IO.EndOfStreamException: Expected 20 bytes but only received 0 before the stream ended.

I spent last night on this, trying to play with settings in my catch2.runsettings file, VS configuration, testEnvironment.json file - no success. I missed something? Any suggestions?

And some additional info:

  1. Local environment: Visual Studio Pro 2022 (64 bit) v.17.8.2 running on Windows 10 Pro 22H2, fully updated
  2. Remote environment: VM running Ubuntu 22.04.3 LTS with latest build utils, OpenSSH, fully updated
  3. Connection type: SSH
0

There are 0 answers