Delphi DunitX FMX GUI logger

Viewed 1701

I have a console based DUNITX unit test program which I am trying to convert to the FMX GUI output. Having read the embarcadero docs here, I modified the Test program file by doing the following:

  1. included the DUnitX.Loggers.GUIX unit
  2. Commented out the DUnitX.Loggers.Console unit
  3. Commented out the {$APPTYPE CONSOLE} directive
  4. Changed the Logger to logger := TGUIXTestRunner.Create(nil);

the modified listing looks like this:

program HTMLParserTest;

{$IFNDEF TESTINSIGHT}
//{$APPTYPE CONSOLE}
{$ENDIF}{$STRONGLINKTYPES ON}
uses
  System.SysUtils,
  {$IFDEF TESTINSIGHT}
  TestInsight.DUnitX,
  {$ENDIF }
 //  DUnitX.Loggers.Console,
  DUnitX.Loggers.GUIX,
  DUnitX.Loggers.Xml.NUnit,
  DUnitX.TestFramework,
  test.ITUtils.Delphi in 'test.ITUtils.Delphi.pas',
  ITUtils.Delphi in '..\Concept Test\ITUtils.Delphi.pas',
  test.ITsimplehtmlparser.Delphi in 'test.ITsimplehtmlparser.Delphi.pas',
  ITTools.simplehtmlparser.Delphi in '..\Concept 
   Test\ITTools.simplehtmlparser.Delphi.pas';

var
  runner : ITestRunner;
  results : IRunResults;
  logger : ITestLogger;
  nunitLogger : ITestLogger;
begin
{$IFDEF TESTINSIGHT}
  TestInsight.DUnitX.RunRegisteredTests;
  exit;
{$ENDIF}
try
//Check command line options, will exit if invalid
TDUnitX.CheckCommandLine;
//Create the test runner
runner := TDUnitX.CreateRunner;
//Tell the runner to use RTTI to find Fixtures
runner.UseRTTI := True;
//tell the runner how we will log things
//Log to the console window
// logger := TDUnitXConsoleLogger.Create(true);
logger := TGUIXTestRunner.Create(nil);
runner.AddLogger(logger);
//Generate an NUnit compatible XML File
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
runner.AddLogger(nunitLogger);
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;

//Run tests
results := runner.Execute;
if not results.AllPassed then
  System.ExitCode := EXIT_ERRORS;

{$IFNDEF CI}
//We don't want this happening when running under CI.
if TDUnitX.Options.ExitBehavior = TDUnitXExitBehavior.Pause then
begin
  System.Write('Done.. press <Enter> key to quit.');
  System.Readln;
end;
{$ENDIF}
except
on E: Exception do
  System.Writeln(E.ClassName, ': ', E.Message);
end;
end.

When I run this (using Tokyo 10.2) I get the following error :

enter image description here

I should also note that I had to include the path to the DUNITX source in my library path as it didn't find the fmx form to compile.

I assume there is something i am missing here, any help would be appreciated as the documentation is a little thin on the ground for this.

Thanks

1 Answers
Related