[FR]: Enhanced Usability – Test Discovery, Reporting, Mocking Integration, and Fixture Improvements
- Dominant language
- C++
- Stars
- 39.5k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
### Does the feature exist in the most recent commit?
No, the proposed features (automatic test discovery, integrated mocking, enhanced reporting formats, streamlined parameterized fixtures, and build-system flexibility) are not available in the latest commit. While GoogleTest provides basic XML reporting and parameterized tests, the advanced usability enhancements suggested are not implemented.
### Why do we need this feature?
While GoogleTest is robust and widely used, it lacks certain modern testing conveniences that improve developer productivity and CI/CD integration. Features like automatic test discovery, built-in mocking support, ergonomic parameterized fixtures, and structured reporting formats are common in other testing frameworks (e.g., pytest, Jest) but absent here. Workarounds exist (e.g., writing custom CMake scripts or using third-party tools), but they add complexity and overhead, especially for new users or large projects.
### Describe the proposal.
The proposal includes the following enhancements:
1. Automatic Test Discovery: A built-in utility or macro system that registers and runs all test files in a directory automatically, reducing manual test list maintenance.
2. Built-in Mocking Integration: Unified API where basic mocking functionality is exposed directly in GoogleTest without requiring separate includes or deeper knowledge of GoogleMock internals.
3. Modern Reporting Support: Add native output support for JSON, JUnit XML, or HTML to better support CI/CD pipelines and test dashboards.
4. Improved Parameterized Fixtures: Provide a cleaner and more declarative syntax for writing parameterized test fixtures, reducing the verbosity and learning curve.
5. Support for Alternative Build Systems: Offer official templates or modules for build systems like Make, Bazel, and Meson to improve out-of-the-box usability.
Example (Test Discovery Usage):
// Instead of manual registration in main
GTEST_AUTO_DISCOVER_TESTS();
Example (Mocking Integration):
MOCK_METHOD(MyClass, doSomething, (), (override));
// Or more seamlessly:
EXPECT_CALL(myMock, doSomething()).Times(1);
### Is the feature specific to an operating system, compiler, or build system version?
No, the features are not specific to any OS or compiler. However, the build system support enhancement would require configuration files/templates specific to common build tools (CMake, Make, Bazel, etc.), but the functionality itself remains cross-platform and compiler-agnostic.
Contributor guide
Research direction
No files, tests, or entry points are named. The proposal combines test discovery, mocking, reporting, fixtures, and build-system support; first narrow it to one independently scoped enhancement and identify the relevant subsystem before implementation. Done would require an agreed scope, design, implementation, and validation for that single feature.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system, ci-cd, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100