none
Creating a unit test library for a C++ WinRT library

    Question

  • I dont have much experience with Visual Studio testing framework. I am trying to create a Unit test library for a C++ WinRT library. I created a Unit Test Library and added a reference to the WinRT library. My WinRT library contains ref classes as well as "ordinary" classes that are not exposed. My problem is how do I test the ordinary C++ classes from the Unit test library as they are not accessible from the test library.

    Friday, March 09, 2012 1:55 AM

All replies

  • Hello,

    I would suggest you to create a native unit test project to test ordinary C++ class. You can find this project in Visual C++\Test\Native Unit Test Project.

    We can separate test the native part and WinRT part, and then include the native part as the reference into your WinRT project.

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, March 12, 2012 6:59 AM
  • The ordinary classes are not ref classes, but they do contain some WinRT datatypes. I simply didnt make them ref as they are not needed outside the assembly. A Native Unit test will not be suitable to test them as they do not pure C++ either!
    Thursday, March 15, 2012 7:55 PM
  • I followed the instructions here to create a unit test in the same project for a WinRT dll.

    http://msdn.microsoft.com/en-us/library/hh419385%28v=vs.110%29.aspx#sameProject

    Basically modified the include and the library paths and create a C++ unit test class in the same project. When i run the unit test, it says 

    ------ Run test started ------
    An internal error occurred while launching test executor for Windows Metro style app.



    • Edited by amshinde Thursday, March 15, 2012 9:51 PM
    Thursday, March 15, 2012 9:49 PM
  • Possible solutions discussed at

    http://social.msdn.microsoft.com/Forums/en-US/vstest/thread/e6a0b7f2-05f0-4bd4-bff1-2c2123398f56

    Thanks


    Regards,
    Vikram Agrawal,
    Developer, VSTLM, Microsoft Corporation


    Friday, April 27, 2012 2:30 AM