Run Unit-Tests without TestInsight

Issue #36 closed
Jens Weigele created an issue

It would be nice if I can run a Unit-Test also without TestInsight. Example: A teammate doesn't have TestInsight installed. If he checks out my unit tests, he should be able to run this without changes. Currently he has to remove the TestInsight define to achieve this.

Suggestion: Add a commandline parameter when running the Tests with TestInsight, so that you can distinguish between "normal" runs and TestInsight runs. Another solution would be to fallback to the "default behaviour", when the connection to your rest server could not be established.

Comments (3)

  1. Stefan Glienke repo owner

    Here's an example on how to achieve that:

    program Project1;
    
    uses
      TestInsight.Client,
      TestInsight.DUnit,
      GUITestRunner,
      SysUtils;
    
    function IsTestInsightRunning: Boolean;
    var
      client: ITestInsightClient;
    begin
      client := TTestInsightRestClient.Create;
      client.StartedTesting(0);
      Result := not client.HasError;
    end;
    
    begin
      if IsTestInsightRunning then
        TestInsight.DUnit.RunRegisteredTests
      else
        GUITestRunner.RunRegisteredTests;
    end.
    
  2. Log in to comment