I recently started using google tests to help me with testing procedures. It is working well but now my test cases are growing...
#include <gtest/gtest.h>
TEST(MyTest, FirstTest) {
// stuff
};
TEST(MyTest, SecondTest) {
// stuff
};
TEST(MyTest, ThirdTest) {
// stuff
};
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
};
I would like to create a nice auto-generated documentation for all my tests that would be separated from the documentation of my program. For that purpose I commonly use doxygen but google tests use macros and it is unclear how doxygen can handle that. More precisely we have
#define TEST(test_case_name, test_name)\
GTEST_TEST_(test_case_name, test_name, \
::testing::Test, ::testing::internal::GetTestTypeId())
I tried
/**
* @def TEST(MyTest, FirstTest)
* @brief My first test
*/
TEST(MyTest, FirstTest) {
// stuff
};
But it does not produces any output on doxygen...
You're using @def
, but that's the command for macro definitions. That command is not followed by a #define
statement, so Doxygen ignores it. The Doxygen command for functions is @fn
, so use that instead.
Also keep in mind that for Doxygen to document global functions, the enclosing file needs to be documented, too.