Dunit console mode - Executing tests twice

769 views Asked by At

I have a dunit test project and I am trying to run it in console mode. When I execute the project it runs twice (it opens only one console window and I see it executing twice the tests) and it is also taking much more time to execute than when I run it in GUI mode. Does anyone know how to run a dunit console test only once?

DPR source code:

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.
1

There are 1 answers

1
Robert Love On BEST ANSWER

You are calling TextTestRunner.RunRegisteredTests twice which is causing your tests to execute twice.

Call it only once and you will be fine.