Hello,
I am just getting started with DUnitX and Delphi for that matter. I have a simple Hello World Delphi project that includes a test case using DUnitX from exercism.io. When I compile it however I get error "Cannot resolve unit name" for;
System.SysUtils
DUnitX.Loggers.Console,
DUnitX.Loggers.Xml.NUnit
I also get an "Undeclared identifier" error for;
TDUnitXConsoleLogger
TDUnitXXMLNUnitFileLogger
But I'm guessing these are declared in the above units. This is the code that has these errors;
program HelloWorld;
{$IFNDEF TESTINSIGHT}
{$APPTYPE CONSOLE}
{$ENDIF}{$STRONGLINKTYPES ON}
uses
//System.SysUtils, // for some reason this line cannot be resolved in my
// RAD Studio 2010
SysUtils,
{$IFDEF TESTINSIGHT}
TestInsight.DUnitX,
{$ENDIF }
DUnitX.Loggers.Console,
DUnitX.Loggers.Xml.NUnit,
DUnitX.TestFramework,
uHelloWorldTests in 'uHelloWorldTests.pas',
uHelloWorld in 'uHelloWorld.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);
runner.AddLogger(logger);
//Generate an NUnit compatible XML File
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
I installed & configured DUnitX as per here so have the DUNITX user environment variable in RAD Studio 2010 set to the path of the source and added it to the Delphi Library path.
I've used SysUtils in other exercise programs without prefixing it with "System." and it worked (and works here) fine. Also I do see DUnitX.Loggers.Console.pas and DUnitX.Loggers.Xml.NUnit.pas in DUnitX's source path. So I'm guessing my IDE is not properly setup somehow to resolve fully qualified unit names but I'm not sure where/how to fix this.