bneumann / CppUTest-Test-Adapter

A test adapter for Visual Studio Code for the C/C++ Unit Test framework CppUTest.
MIT License
16 stars 7 forks source link

Support for Multiple Unit Tests #17

Closed lokimon closed 2 years ago

lokimon commented 2 years ago

We use cpputest in a c environment. Which means without polymorphism, we need to create multiple Unit Test Executables.

Can we get this Test Adapter to support multiple Unit Test Executables?

A couple of ways I can think to do this.

  1. List them manually as an array in the settings.json file. All "cpputestExplorer.testExecutables" would be in the "cpputestExplorer.testExecutablePath" path.
  2. Have cpputestExplorer.testExecutable" support wildcards. We have a convention to name all of our unit test executables with ut_*.

I sort of like option 1. If a unit test executable isn't built or available in the "cpputestExplorer.testExecutablePath" path, it could be marked with the faded color meaning it is known, but not available.

Thoughts?

bneumann commented 2 years ago

Yeah this bugged me as well for some time (see REAMDE ;) ). I think it is possible to support both options, if we check for a delimiter and also for wildcard asterisks. So you could do: myFolder/ut_*;myOtherfolder/ut_specific_binary

If a unit test executable isn't built or available in the "cpputestExplorer.testExecutablePath" path, it could be marked with the faded color meaning it is known, but not available.

That is a really good idea! As far as I remember my own code I already "artificially" add a testsuite to group all tests in a root node. So multiple executables would just be another node on top of that.

bneumann commented 2 years ago

@lokimon I am already on it, but only a few hours a week to spare. And with multi executable comes a bunch of problems so I decided to refactor a lot of code. Also found the root cause of the other issue that you fixed lately. Now I added lots of unit tests and added DI for better testing so that will also come with the next release. I can already show and run all executables but the event handling is missing.

This is just a FYI for you. Not really related to any question

bneumann commented 2 years ago

@lokimon: Check it out. Feedback is highly welcome

lokimon commented 2 years ago

@bneumann We seem to have lost the ability to debug the tests. Running still works. Any ideas?

bneumann commented 2 years ago

I feared as much. You got any logs? I tried it under windows and it worked there AFAIK you work under Linux right? Will try later in my wsl

bneumann commented 2 years ago

I think the latest version 1.0.1 should do it. I actually forgot to reconnect some of the new modules to the main container. That way the debug information was missing. I also had a wrong implementation for starting the debugger in groups both should be fixed now, check it out

lokimon commented 2 years ago

Nailed it! Thanks!