locked
Unit tests RRS feed

  • Question

  • I keep reading how simple it is to use visual studio builtin unit tests. They all say "Just right click next to a method and slect unit test, its that easy!!!" So I right click and there is no unit test option. How do I do this?
    Thursday, February 11, 2010 3:10 AM

Answers

  • This option is available only in the Visual Studio Team System edition.
    «_Superman_»
    Microsoft MVP (Visual C++)
    • Proposed as answer by Wesley Yao Friday, February 12, 2010 5:36 AM
    • Marked as answer by Wesley Yao Wednesday, February 24, 2010 2:53 AM
    Thursday, February 11, 2010 5:50 AM
  • Hi Mscheaf,

    Sorry for the delay.

    Please check this article Unit Tests and C++, as this article says:

    You can generate unit tests into a Visual C++ test project. You can generate these tests from a Visual C++ production code project. Please note the following:

    ·         Production code project. If your production code is written in Visual C++, you can generate unit tests only if your product uses the /clr:safe compiler option. 

    ·         Test project. Code generation can produce unit tests in any of the Visual C++ test project types: mixed, safe, and pure. The default project type produced is a /clr:safe project. If you want to change your project to /clr or /clr:pure, you do so at any time by using Visual C++ compiler options. For more information, see /clr (Common Language Runtime Compilation).

    Best Regards,

    Nancy



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Wesley Yao Wednesday, February 24, 2010 2:53 AM
    Friday, February 19, 2010 2:42 AM
  • Have you  watched the "Rocket Commander game tutorial" It has some good stuff on "NUnit" if it is still available using C++.
    This tutorial is what got me interested in NUnit testing in the first place. Although the video is hard to navigate through!

     Visual studio is not easy to use . As long as people keep messing around with languages that are built atop of other languages their will be compatibility problems and cross platform problems. ANSI C99, C++, and Unix are the only languages people should be concerned with really because they were engineered by real Scientists and do not incorporate  such nonsense as 5 different versions of English.


     Taking shortcuts with a language that was designed to be easier to read will prevent you from doing what you are trying to do because you are using what someone else thinks a language should be which places restrictions on the user. For instance you make a program that uses a function but the function will not allow you to do what you want it to do so then you have to do tons of research on some lame language. "take a look at Java" There is a microsoft version and then their is a Sun Micro systems version "Like whatever" why would someone want to deal with that mess.
     Also if someone wanted to hack your program it would be very easy which I think is one of the main reasons for this non sense.
    Don't get me wrong They are great but Visual Basic and C# always stand in the way of what I want to do also. Which is mathematical and Scientific programming which is the sole purpose of what programming really is and also to compute data.
     I hope the tutorial was of some help.
    • Marked as answer by Wesley Yao Wednesday, February 24, 2010 2:53 AM
    Friday, February 19, 2010 5:04 AM

All replies

  • This option is available only in the Visual Studio Team System edition.
    «_Superman_»
    Microsoft MVP (Visual C++)
    • Proposed as answer by Wesley Yao Friday, February 12, 2010 5:36 AM
    • Marked as answer by Wesley Yao Wednesday, February 24, 2010 2:53 AM
    Thursday, February 11, 2010 5:50 AM
  • So how do I do unit tests in c++/cli. I can't figure it out. I right clicked on solution explorer and added new test project. From there I added a unit test and selected the class I want to test. Keep in mind it auto generates all code at this point. Try to run what was there and it gives file not found exceptions. So right off the bat it is screwed up and I haven't even had a chance to touch it yet. How is even ever supposed to work? Is this like EVERYTHING else and I need to download 3rd party add ons?
    Friday, February 12, 2010 4:01 PM
  • I mean I don't get the problem here. This is managed c++ created in VS2008. In the same solution is a c++ unit test all generated by visual studio and it doesn't work. Seriously, what is the point?
    Friday, February 12, 2010 4:12 PM
  • Hi Mscheaf,

    Sorry for the delay.

    Please check this article Unit Tests and C++, as this article says:

    You can generate unit tests into a Visual C++ test project. You can generate these tests from a Visual C++ production code project. Please note the following:

    ·         Production code project. If your production code is written in Visual C++, you can generate unit tests only if your product uses the /clr:safe compiler option. 

    ·         Test project. Code generation can produce unit tests in any of the Visual C++ test project types: mixed, safe, and pure. The default project type produced is a /clr:safe project. If you want to change your project to /clr or /clr:pure, you do so at any time by using Visual C++ compiler options. For more information, see /clr (Common Language Runtime Compilation).

    Best Regards,

    Nancy



    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Wesley Yao Wednesday, February 24, 2010 2:53 AM
    Friday, February 19, 2010 2:42 AM
  • Have you  watched the "Rocket Commander game tutorial" It has some good stuff on "NUnit" if it is still available using C++.
    This tutorial is what got me interested in NUnit testing in the first place. Although the video is hard to navigate through!

     Visual studio is not easy to use . As long as people keep messing around with languages that are built atop of other languages their will be compatibility problems and cross platform problems. ANSI C99, C++, and Unix are the only languages people should be concerned with really because they were engineered by real Scientists and do not incorporate  such nonsense as 5 different versions of English.


     Taking shortcuts with a language that was designed to be easier to read will prevent you from doing what you are trying to do because you are using what someone else thinks a language should be which places restrictions on the user. For instance you make a program that uses a function but the function will not allow you to do what you want it to do so then you have to do tons of research on some lame language. "take a look at Java" There is a microsoft version and then their is a Sun Micro systems version "Like whatever" why would someone want to deal with that mess.
     Also if someone wanted to hack your program it would be very easy which I think is one of the main reasons for this non sense.
    Don't get me wrong They are great but Visual Basic and C# always stand in the way of what I want to do also. Which is mathematical and Scientific programming which is the sole purpose of what programming really is and also to compute data.
     I hope the tutorial was of some help.
    • Marked as answer by Wesley Yao Wednesday, February 24, 2010 2:53 AM
    Friday, February 19, 2010 5:04 AM
  • Here is another option, if you guys are unit testing only native code C/C++, Check this article Simplified Unit Testing for Native C++ Applications on WinUnit.
    Anand K Reddy
    akx++ Solutions
    Tuesday, May 17, 2011 5:27 PM