Rename EXE before running tests

Issue #23 closed
Steffen Binas created an issue

I have several hundred test cases in my application which take some minutes to complete. Using TestInsight I cannot continue working as the exe is running and cannot be overwritten by the compiler. What could help would be renaming the .exe before executing. So I could code/compile/run while tests are running completely in the background.

Comments (3)

  1. Stefan Glienke repo owner

    You can achieve this using the tool options.

    Create a simple program like this:

    program CopyAndRun;
    
    uses
      ShellAPI,
      SysUtils,
      Windows;
    
    var
      exeName: string;
      newPath: string;
      newExeName: string;
    begin
      exeName := ParamStr(1);
      newPath := ExtractFilePath(exeName) + 'TestInsight\';
      newExeName := ChangeFilePath(exeName, newPath);
      ForceDirectories(ExtractFileDir(newExeName));
      CopyFile(PChar(exeName), PChar(newExeName), False);
      ShellExecute(0, 'open', PChar(newExeName), nil, nil, SW_SHOW);
    end.
    

    And execute from the IDE (main menu -> Tools -> Configure Tools).

    Add the CopyAndRun.exe in program and in parameters you add: $EXENAME

    This will call the CopyAndRun.exe with the name of the exe of the currently active project.

  2. Steffen Binas reporter

    I followed your advice and modified CopyAndRun to fit my needs. It works much better than running via old DUnit-GUI. It pays off that TestInsight works as a rest server. Thank you. The only drawbacks are that I cannot use "Test On Save" and "Test On Idle" this way and I cannot stop the tests via TestInsight-GUI.

  3. Log in to comment