cvisual-studiounit-testingtest-explorer

Is it possible to use Visual Studio 2022 Test Explorer to run C unit test?


I would like to run ansi C unit tests in VS by mean of Test Explorer (not only with Console).

I saw that it's possible for C++ projects (https://learn.microsoft.com/it-it/visualstudio/test/writing-unit-tests-for-c-cpp?view=vs-2022), but I can't find any help about writing pure C test in Visual Studio.

Is it feasable? And in case how? Thx.


Solution

  • Yes, it is. See my example. (To avoid LNK2019 error you shall include *.c to your test project, not *.h).