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

Setup question - source has changed but `make` is not run #42

Open dabell-cc opened 1 year ago

dabell-cc commented 1 year ago

Hi there, Quite novice to CppUTest and this adapter, please bear with me - it just seems I'm missing something.

I have the Test Executable and Test Executable Path configured in the extension settings like this:

"cpputestTestAdapter.testExecutable": "${workspaceFolder}/t/Example_tests",
"cpputestTestAdapter.testExecutablePath": "${workspaceFolder}/t/"

Now when I change my source I don't see the test result change in the VS Code Testing panel, even though I've intentionally broken it. Example:

int test_func(void)
{
   return 0; //was supposed to return 1
}

I take this to be because this extension is not re-running make, so the production code change isn't being picked up. What I'm left wondering is how this extension is meant to be used for maximum benefit.

Otherwise my process would look like:

This sequence of steps does work for picking up changes, I just expected this to be more automatic. What am I missing here?

For info I'm using Ubuntu 14.04, VS Code 1.69.2, CppUTest latest.

bneumann commented 1 year ago

Hi, no this totally fine. There is no automatic rebuild or file watcher at the moment. That is because in C/C++ you have such a big variety of builders, toolchains, tools etc. that can be used to trigger a rebuild. What I could think if is to have a VSCode task to run before executing the tests. That would be pretty easy to implement i guess and you won't need to support all the specifics inside the test runner tool.

When I was doing C programming I used to have a build task that could be trigger by using Ctrl+Shift+B or something and after the build i clicked run tests. So that was my workflow but I can understand that you aim for more automation.

I quickly browsed through the code and thought I actually added a file watcher on the executables to have at least a retire of tests if the test runner changes but I guess I forgot to implement that ;)

I think this is a good first issue for contributers as I will not be able to do much on the code in the next time. Maybe in winter :)

dabell-cc commented 1 year ago

Thanks for clarifying! A build task makes sense.

I think in that case I'd modify my Makefile to stop short of running the tests. If using the MakefileWorker.mk provided with CppUTest, the tests get run immediately after building. That seems unnecessary if CppUTest-Test-Adapter is going to run the tests anyway.