Giter VIP home page Giter VIP logo

gtpp's Introduction

Google Test Pretty Printer

gtpp (Google Test Pretty Printer) is a pretty printer / test listener for Google Test.

Google Test is a great testing framework for C++. It has lots of powerful features, good popularity, a fully functional mocking library that works with it…

There's one problem. Google Test is loud. gtpp makes it much more pleasant to use.

See these screenshots for an example.

(gtpp is not a Google project. The author is not affiliated with Google.)

Features

  • Quieter output - By default, Google Test prints 2 lines of output per individual test, plus 3 lines for every test case. gtpp prints one line per test case under normal operation, without sacrificing any detail if individual tests fail or need more detailed output.
  • If even that's more verbose than you'd like, then use --failures-only, and only failing tests (or any test with actual output) will be left on the screen.
  • Automatic verbosity - If test filtering is enabled, because you're trying to zero in on particular problems, gtpp automatically switches to more verbose output.
  • Details of test failures - The list of failed tests at the end includes actual actual and expected values, instead of forcing you to scroll back up to find details on what went wrong.
  • Smart time output - Google Test prints how long each test takes. gtpp enhances this to only print interesting test cases' times (over 50 ms by default; configurable with --print-time=N), to help you focus on slow tests.
  • Unicode output - because every test runner needs ✓ and ✗. You can use the --ascii option to switch back to plain ASCII if your terminal doesn't support these characters.

Usage

  1. Clone the repository.

    git clone https://github.com/joshkel/gtpp.git
    
  2. Install prerequisites. For example, on Ubuntu:

    sudo apt-get install python3-colorama
    

    Or set up a virtualenv and install prerequisites there.

    cd gtpp
    python3 -m venv env
    . env/bin/activate
    pip install -r requirements.txt
    
  3. Run your unit tests through gtpp. For example:

    path/to/gtpp.py ./test_suite [--gtest_args...]
    # Or
    path/to/gtpp.py make test
    

    Or run your tests normally and pipe the results through gtpp. For example:

    make test |& path/to/gtpp.py
    

Why Python?

Google Test provides its own Event Listener API, so why write an external program? Partly for flexibility - this allows any test suite that uses Google Test to work, without source modifications - and partly for power - because the external program sees all of the output, it can add features like including failing tests' full output at the end of the run.

gtpp's People

Contributors

joshkel avatar aunitt avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.