Dunit Console Mode - Running Tests Twice

I have a dunit testing project and am trying to run it in console mode. When I execute the project, it starts twice (it opens only one console window, and I see that it runs the tests twice), and it takes much longer to complete this than when starting in the GUI mode. Does anyone know how to run dunit test console only once?

Download Source Package DPR:

var  
  R: TTestResult;  

begin  
  Application.Initialize;  
  if IsConsole then begin  
    with TextTestRunner.RunRegisteredTests(rxbHaltOnFailures) do begin  
      R := TextTestRunner.RunRegisteredTests;  
      ExitCode := R.ErrorCount + R.FailureCount;  
      Free;  
    end  
  end  
  else begin  
    GUITestRunner.RunRegisteredTests;  
  end;  
end.
+3
source share
1 answer

You call TextTestRunner.RunRegisteredTeststwice, which causes your tests to run twice.

Call him only once, and everything will be all right.

+9
source

Source: https://habr.com/ru/post/1791050/


All Articles