Run and Show Results From Multiple Test Projects

Issue #106 wontfix
Ben Brandt created an issue

We have multiple production DLL's that each have their own DUnit2 test EXE. We would like to see all test results from all test project EXE's in TestInsight at the same time like we are used to with ReSharper or VS Test Explorer.

Preferably, we'd like to see the test project EXE names as top-level nodes in the TestInsight tree with the tests grouped under each test project.

Issue #82 & #87 are similar, but still only relate to running a single test project at a time.

Comments (2)

  1. Ben Brandt reporter

    As a workaround, I have an AllTestRunner.exe project I've added to my group project for the purpose of running all the "*Tests.exe" in the output folder.

    #include <vcl.h>
    #include <windows.h>
    
    #pragma hdrstop
    #pragma argsused
    
    #include <tchar.h>
    
    #include <stdio.h>
    #include <System.IOUtils.hpp>
    
    int _tmain(int argc, _TCHAR* argv[])
    {
       const bool runTestsInParallel = false;
    
       String testFolder = ExtractFilePath(ParamStr(0));
       TStringDynArray testProjects = TDirectory::GetFiles(testFolder, L"*Tests.exe");
    
       STARTUPINFO startupInfo;
       PROCESS_INFORMATION processInformation;
    
       ZeroMemory( &startupInfo, sizeof(startupInfo) );
       startupInfo.cb = sizeof(startupInfo);
       ZeroMemory( &processInformation, sizeof(processInformation) );
    
       SetErrorMode(SEM_NOGPFAULTERRORBOX);
    
       for(int i = testProjects.Low; i <= testProjects.High; ++i)
       {
          if( !CreateProcess( NULL,   // No module name (use command line)
                testProjects[i].c_str(),        // Command line
                NULL,           // Process handle not inheritable
                NULL,           // Thread handle not inheritable
                FALSE,          // Set handle inheritance to FALSE
                0,              // No creation flags
                NULL,           // Use parent's environment block
                testFolder.c_str(),
                &startupInfo,
                &processInformation )
             )
          {
             printf( "CreateProcess failed (%d).\n", GetLastError() );
          }
          else if(!runTestsInParallel)
          {
             WaitForSingleObject( processInformation.hProcess, INFINITE );
    
             DWORD exitCode = 0;
             BOOL result = GetExitCodeProcess(processInformation.hProcess, &exitCode);
    
             // TODO: Report projects that exited with an error code in the
             // TestInsight panel - see result & exitCode
    
             CloseHandle( processInformation.hProcess );
             CloseHandle( processInformation.hThread );
          }
       }
    
        return 0;
    }
    
  2. Log in to comment