TestInsight doesn't respect user's DUnit configuration.

Issue #9 closed
Nicholas Ring created an issue

In TestInsightRunner.pas, it forces "Fails if no checks [are] executed" to be true with the following code:

result.FailsIfNoChecksExecuted := True;

I think what should also occur is the following code:

Suite.LoadConfiguration(IniFileName, False, True);

So the RunRegisteredTests should be changed to:

procedure RunRegisteredTests(const baseUrl: string); var result: TTestResult; suite: ITestSuite; begin result := TTestResult.Create; try result.FailsIfNoChecksExecuted := True; result.AddListener(TTestInsightListener.Create(baseUrl)); suite := RegisteredTests; suite.LoadConfiguration(IniFileName, False, True); if Assigned(suite) then suite.Run(result); finally result.Free; end; end;

Comments (9)

  1. Nicholas Ring reporter
    procedure RunRegisteredTests(const baseUrl: string);
    var
      result: TTestResult;
      suite: ITestSuite;
    begin
      result := TTestResult.Create;
      try
        result.FailsIfNoChecksExecuted := True;
        result.AddListener(TTestInsightListener.Create(baseUrl));
        suite := RegisteredTests;
        if Assigned(suite) then
        begin
          suite.LoadConfiguration(IniFileName, False, True);
          suite.Run(result);
        end;
      finally
        result.Free;
      end;
    end;
    
  2. Nicholas Ring reporter

    Reported for DUnit but it doesn't seem (code-wise) DUnit2 loads up the user's configuration either.

  3. Stefan Glienke repo owner

    The problem with DUnit in its current implementation is that some options even if you can set them on the ITestSuite are not in effect because they get overridden by those of the TTestResult (as happening with FailsIfNoChecksExecuted). That is why I could not use the RunTest routine as you did in the DUnit2 unit. For DUnit I need to create the TTestResult and set the option there to make it work.

    Apart from that I don't see any useful options inside the config file. Usually that file saves the selected tests which I don't need/want when running with TestInsight because.

    Also if you look at the TextTestRunner you see that it does not load the config either.

  4. Nicholas Ring reporter

    The issue I am having is that we work's test suite, we also use PascalMock (stuck on XE :( ) which we use the Verify call. This raises an exception when it fails but does nothing when it passes - the test is verifying that a repository/etc gets called with the correct parameters.

    Because fail when no checks is enabled, there are a lot of false positives.

  5. Log in to comment