2

I have managed test Project for VisualStudio 2015 C++ Program,

it working properly but I want to run the same test cases in Linux environment,

for the normal c++ Program I have make files, I don't know how to run the visual studio 2015 managed c++ test project in Linux, here is my sample program..

sample.h


#ifndef GUARD_SAMPLE
#define GUARD_SAMPLE
void method1();
void method2();
void method3();

and my c++ program is sample.cpp

  #include "sample.h"

  void method1()
{
  int a,b=20,c=30;
  a=b+c;
  cout<<"sum is"<<a;
}

void method2()
{
  int a,b=20,c=30;
  a=b-c;
  cout<<"sub is"<<a;
}

void method3()
{
  int a,b=20,c=30;
  a=b*c;
  cout<<"mul is"<<a;
}

And my test program is sample_Test.cpp

 #include "sample.h"

  namespace sample_MDM_Test
{
[TestClass]
public ref class sample_Testing
{
public: 
    [TestMethod]
    void Test_method1()
    {
        ::method1();
    }

    [TestMethod]
    void Test_method2()
    {
     ::method2();
    }

    [TestMethod]
    void Test_method3()
    {
     ::method3();
    }

i can run c++ application using make file , but how to run these unit test functions in Linux environment(for the windows environment It's fine).

Plese, help me.

Lavakusa
  • 105
  • 1
  • 15
  • AFAIK neither managed nor native VS C++ unit tests can work on non-windows systems. Personally I would like to use native VS C++ unit tests everywhere as they aren't so macro-infested as other testing frameworks, however I had to stick with boost test. – user7860670 Jul 15 '17 at 11:49
  • @VTT: Is there any way to run managed unit cases in Linux environment ?? Give me any suggestion. – Lavakusa Jul 15 '17 at 11:59
  • As I wrote in my first comment, there seems to be no way to run them on Linux. – user7860670 Jul 15 '17 at 12:02

1 Answers1

1

Since sample_Test.cpp is not c++ but c++/cli you cannot run it native in a linux environment. Look here Does Mono .NET support and compile C++ / CLI? for further information.

If you only need native c++ have a look for gtest/gmock as testing framework. That will run on Windows and Linux and there is a Test Adapter that integrates into VS2015.

Tobias Wollgam
  • 761
  • 2
  • 8
  • 25