CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2019

    Unit testing in C++?

    Hey guys,
    I have recently got a new job and they require unit tests everywhere, such that it will cover at least 80% of the codebase.

    I am not familiar with test frameworks and/or mocking tools in C++. I wonder if you have something recommended for me, from your experience as it is a new project so I determine what framework and what mocking tool to use here.

    Thank you!

  2. #2
    Join Date
    Nov 2018

    Re: Unit testing in C++?

    So what do they use on all their other older projects?

    It would make sense to use what other people (who've been there longer) already know how to use.

  3. #3
    Join Date
    Dec 2019

    Re: Unit testing in C++?

    Hey Alice,

    Have you written unit tests for other languages before then?

    For me, I use MSTest as my testing framework because it's the most intuitive for me, along with a great mocking tool I've found just recently, that has no limitations (like other mocking tools I used before). The name is Isolator++ and it became free just a month ago. I recommend.

  4. #4
    Join Date
    Oct 2006

    Re: Unit testing in C++?

    I like google test, it's an extremely powerful framework.
    These days it's also supported by Visual Studio
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    and before posting

    Refresh your memory on formatting tags here

    Get your free MS compiler here

  5. #5
    Join Date
    Nov 2003

    Re: Unit testing in C++?

    I use both MSTest and Google test.
    Marc Gregoire - NuonSoft (
    My Blog
    Wallpaper Cycler

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width