locked
Problem adding unit tests in the same C++ project RRS feed

  • Question

  • Hello. 

    I have a big problem, i would like test internal classes using the Unit Test framework provided by VS2011.

    I followed the step listed in: http://msdn.microsoft.com/en-us/library/hh419385(v=vs.110).aspx#sameProject

    But when I tried to run the test I got the following error:

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

    Then I  tried to run the test in debug mode and I had the following message:

    ------ Run test started ------

    Value cannot be null.
    Parameter name: packageFullName
    ========== Run test finished: 0 run (00:00:00.0149357) ==========

    Also I tried run the test using vstest.console.exe and the result was:

    Error Message:
       Failed to set up the execution context to run the test

    If someone know how make it work, please help me :)

    Regards

    Friday, April 20, 2012 9:46 PM

Answers

  • Hello,

    I would suggest you to create a unit test project for metro style application.

    The document in that project is only for native application. There is no include the metro test references into the test project.

    1. Create a unit test project
    File->New->Project->Visual C++->Windows Metro style->Unit Test Library

    2. Include your tested project into Unit Test project.
    Right Click your test project->References->Add New Reference->Projects->select your project.

    3. Include the tested project namespace into your unit test project.

    Best regards,
    Jesse


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

    • Marked as answer by _EnderW Friday, May 4, 2012 1:33 PM
    Thursday, April 26, 2012 9:48 AM

All replies

  • Hello,
     
    Thanks for your feedback, I will involve more experts to investigate it.
     
    Best regards,
    Jesse

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

    Monday, April 23, 2012 2:51 AM
  • Hello,

    I would suggest you to create a unit test project for metro style application.

    The document in that project is only for native application. There is no include the metro test references into the test project.

    1. Create a unit test project
    File->New->Project->Visual C++->Windows Metro style->Unit Test Library

    2. Include your tested project into Unit Test project.
    Right Click your test project->References->Add New Reference->Projects->select your project.

    3. Include the tested project namespace into your unit test project.

    Best regards,
    Jesse


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

    • Marked as answer by _EnderW Friday, May 4, 2012 1:33 PM
    Thursday, April 26, 2012 9:48 AM
  • But in this way, there is no chance to test internal classes, only public classes can be tested.

    if i added a unit test, the tests are listed in the Test Explorer, it would be great if MS added support for run this kind of test not only for native applications.

    Is there any chance of this feature addition?

    Regards



    Marcelo

    Thursday, April 26, 2012 1:02 PM
  • Hello,

    Thanks for your feedback, you can make your wish in this site
    Visual Studio UserVoice site

    Best regards,
    Jesse


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

    Tuesday, May 8, 2012 4:59 AM