Documenting google tests

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.


Appearantly your question was just answered with Rob Kennedy's answer. But nevertheless I want to offer a completely different approach.

I use the RecordProperty() method of gtest to create an extra description attribute in the test log XML and just pass it a short description of what the test method is doing as string literal. I've created a little macro named TEST_DESCRIPTION that's supposed to be called as first statement in any test case:

#define TEST_DESCRIPTION(desc) RecordProperty("description", desc)

TEST(MyTest, SecondTest) {
    TEST_DESCRIPTION("This test does 'stuff'");
    // stuff
};

Additionally I have a simple XSLT transformation that creates a HTML test report from the XML testlog output and shows this @description attribute.

A drawback of this method is that the description attribute won't appear for disabled tests, since RecordProperty() won't be executed for those of course.

The whole thing was invented as my boss asked for test case descriptions of unit tests and I didn't want to describe these in a separate tool (e.g. we have Polarion for requirements analysis and you could also describe test scenarios there) because this is likely to become inconsistent quickly.

But maybe doxygen may provide additional benefits as it's able to show the call references from your test methods.