Giter Site home page Giter Site logo

unit_test_playground's Introduction

Unit Test Playground

Introduction

This repository serves as a playground for getting started with writing unit tests with the googletest (gtest) framework. The code is split into two parts, production code and test code. Production code are the software parts which are delivered to the customer or are used to build the binaries. The test code is usually seperated from the production code and is used to verify the functionality of the production code. Once the code is verified, the test software is removed and the production code gets shipped.

Production Code

Production code should be added to the directories 'src' and 'include'. The source files (cpp) have to be added to the CMakeLists.txt file, in order to be built. A comment in the file indicates where to add them.

Test Code

All test related code should be added to the 'unit_tests' directory. Similar to other source files, their names and path have to be added to the CMakeLists.txt file.

The unit_tests directory already contains to files, namely test_runner.cpp and test_template.cpp. The former automatically picks up all defined tests and runs them. You can edit this file but usually you are not required to do so. The test_template.cpp includes everything you should need to get started with writing your own tests.

Building the Software

The software is built using cmake and requires a network connection if built for the first time to download the googletest framework.

The build.sh will create a 'build' directory and perform all necessary steps to build the test application. If everything works as expected, the application test_runner should be present in the build directory. Commandline arguments are forwarded to googletest. Call the application with the help flag (--help) to get yourself familiar with its options.

unit_test_playground's People

Contributors

alexzoe avatar

Watchers

 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.