Menu

MfcTestRunner assertion

Help
berc
2006-08-02
2013-04-22
  • berc

    berc - 2006-08-02

    Hello,

    I am attempting insert CppUnit test suite directly to my MFC windows application.
    With TextTestRunner is not any problem.
    But when I try use MfcTestRunner it assert in run() function:

    bool cdxCDynamicWndEx::RestoreWindowPosition(LPCTSTR lpszProfile,
                                                 const CString &entryPrefix,
                                                 UINT restoreFlags)
    {
        if(!IsWindow() || !lpszProfile || !*lpszProfile)
        {
            ASSERT(false);
            return false;
        }

        CWnd        *pWnd    =    Window();
        CWinApp    *app    =    AfxGetApp();

        if(!app->m_pszRegistryKey || !*app->m_pszRegistryKey)

    part of source code is:
        void CMyWinApp::OnUnitTest()
        {
            CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
    pFrame->m_pMsgWait->ShowInfo(MAKESTRING(IDS_INFO3009));

            // declare a test runner, fill it with our registered tests and run them
            CppUnit::MfcTestRunner runner;
            runner.addTest( CppUnit::TestFactoryRegistry::getRegistry().makeTest() );
            runner.run();
    ...

    Please, can anybody tell me, where can be problem and if using of MfcTestRunner is possible directly in tested CWinApp?

    Thanks for ansfer.

     
    • berc

      berc - 2006-08-02

      (assertion:
      CWinApp *app =AfxGetApp(); returns 0x00000000 value)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.