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

    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
    Posts
    120

    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
    Posts
    1

    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
    Location
    Sweden
    Posts
    3,654

    Re: Unit testing in C++?

    I like google test, it's an extremely powerful framework. https://github.com/google/googletest
    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
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  5. #5
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Unit testing in C++?

    I use both MSTest and Google test.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

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

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

Featured