DEV Community

Cover image for Google Test - missing feature
Elvis Oric
Elvis Oric

Posted on • Updated on

Google Test - missing feature

Test-Driven Development. Red-Green-Refactor.
Let's start. You are working on an awesome project in C++ and for TDD you are using the Google testing framework.

A typical scenario when using TDD:

  • The new behavior is introduced and described by a falling test. We have RED.
  • Logic is implemented, the test is PASSING. We have GREEN.
  • The last step, REFACTOR test and implementation if possible.

After that, we run all the tests and we notice that we have 17 falling tests.
What about re-running only failing tests?
What about re-running the first and last failing tests?

This is something that kept popping up to me.
Google Test does not support anything like this, so I decided to write my solution. Github link

What is it?

Wrapper around Google tests

What it solves?

It allows you to re-run failed tests as well as to filter those failed tests by using numeric tags

How to use it?

  • Set which executable file will be executed:
./gtester.py --exe exe_name
Enter fullscreen mode Exit fullscreen mode
  • Run all tests:
./gtester.py
Enter fullscreen mode Exit fullscreen mode
  • Run just failing tests:
./gtester.py --run_failing
Enter fullscreen mode Exit fullscreen mode
  • Run several failing tests using tags:
./gtester.py --run_failing 1 3
Enter fullscreen mode Exit fullscreen mode

Example

Demo

Top comments (0)