The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
[UWP][C++]Using C++ Unit Testing Framework to test UWP App RRS feed

  • Question

    1. I have a C++ class with methods in a C++ UWP App MyApp::MyMath.
    2. I have created a C++ Unit test project to test the UWP app.
    3. I added a reference to the UWP app to the Unit test app.
    4. the code compiles fine.
    5. When I run the test, I get an error

    Exception thrown at 0x7455DAD8 (KernelBase.dll) in UnitTests.exe: 0x40080201: WinRT originate error (parameters: 0x80040154, 0x00000016, 0x0ED5E798).
    Exception thrown at 0x7455DAD8 in UnitTests.exe: Microsoft C++ exception: Platform::ClassNotRegisteredException ^ at memory location 0x0ED5EC38. HRESULT:0x80040154 Class not registered

    What step am I missing?

    Thanks,

    Michael

    #include "pch.h"
    #include <CppUnitTest.h>
    
    
    using namespace Microsoft::VisualStudio::CppUnitTestFramework;
    
    
    namespace UnitTests
    {
        TEST_CLASS(UnitTest1)
        {
        public:
            TEST_METHOD(TestMethod1)
            {
    			auto test = ref new MyApp::MyMath; // class not registered error here
    
    			test->Add(1, 2);
            }
        };
    }


    Michael S. Scherotter Media Experience Evangelist Microsoft Corporation http://blogs.msdn.com/synergist


    • Edited by Krunal Parekh Thursday, April 28, 2016 7:31 AM subject
    Tuesday, April 26, 2016 6:54 PM

All replies

  • Hi Synergist,

    I was able to reproduce the issue on my side. I created a c++ UWP app and added a mymath class when i tried to use it in the UnitTest i was able to reproduce the issue. 

    >>Exception thrown at 0x7455DAD8 in UnitTests.exe: Microsoft C++ exception: Platform::ClassNotRegisteredException ^ at memory location 0x0ED5EC38. HRESULT:0x80040154 Class not registered

    Looking at the exeception i found this similar thread. Could you look at it and see that if that is similar issue. See @Alan Yao's Reply that might help. 

    With Regards,

    Krunal Parekh 


    Thanks MSDN Community Support Please remember to Mark as Answer the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Proposed as answer by Krunal Parekh Friday, May 6, 2016 2:11 AM
    Wednesday, April 27, 2016 5:29 AM