Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9251435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:41:53+00:00 2026-06-18T10:41:53+00:00

I am working with Microsoft Visual Studio 2012 Ultimate to write C++ applications. I

  • 0

I am working with Microsoft Visual Studio 2012 Ultimate to write C++ applications. I got that version from my MSDNAA access. My Problem is that I want to create unit tests for the C++ classes I wrote.

Please Note:
It’s standard conform C++, nothing mixed, no C#, it’s just C++ that can also be compiled with the g++.

Under file -> new -> project -> Visual C++ exists something like a “managed testproject”:

However when I create such a project I cannot manage it to add references e.g. to “MyClass.h” and to compile. And I cannot find a simple tutorial for that.

Can anyone help me by showing how to set up a simple C++ Unit Test with Visual Studio 2012?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:41:54+00:00Added an answer on June 18, 2026 at 10:41 am

    You have two choices for C++ unit tests Manage Test Project and Native Unit Test Project. You should select the native one, and then just add the includes you want and write the tests.

    Here is a dummy example where I include a “foo.h” header, instantiate a foo and call one of its methods.

    #include "stdafx.h"
    
    #include "..\foo.h" // <- my header
    
    #include "CppUnitTest.h"
    using namespace Microsoft::VisualStudio::CppUnitTestFramework;
    
    namespace UnitTest1
    {       
        TEST_CLASS(UnitTest1)
        {
        public:
    
            TEST_METHOD(TestMethod1)
            {
                foo f;
                Assert::AreEqual(f.run(), true);
            }
        };
    }
    

    See Unit testing existing C++ applications with Test Explorer for more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with MS Visual Studio 2012 Update 1 on Win 7 Ultimate SP1
I am currently working with Microsoft Visual Studio 2012 and the new Fakes framework.
I faced one issue while working on a C code with Microsoft Visual Studio-2005
I am working on a Windows (Microsoft Visual C++ 2005) application that uses several
I am using boost::interprocess::message_queue, with VC++ (in Microsoft Visual Studio 2005). It is working
sys info : win xp SP3 , Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM
I am currently working on a project using C# and Visual Studio 2012. I
Can someone else confirm that autocomplete HTML tags is not working in Visual Studio
I'm working on Visual Studio 2012 and using C#, I'm using the library DirectShowLib
I am working on Microsoft Visual Studio environment. I came across a strange behavior

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.