Jump to content

fishon

Members
  • Content Count

    3
  • Joined

  • Last visited

Everything posted by fishon

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

    Cannot resolve unit name 'DUnitX.Loggers.Console'

    Seems you reshuffled the files somewhat. I downloaded a new zip and no longer see any code files in the main folder. I tried installing the DUnitX_IDE_Expert_2010.dproj project from the Experts sub-folder but it gave this upon compile;
  3. fishon

    Cannot resolve unit name 'DUnitX.Loggers.Console'

    Hello Vincent, Thanks for your reply. So in the Messages pane at the bottom, in the Build tab I get; When I double click this line it opens up this file which is a source file of DUnitX and red highlights line 32; uses System.Classes, This is the same problem as with System.SysUtils. In Project Options window for Delphi Compiler I tried specifying "System" for either "Default namespace" or "Namespace prefixes" fields and then compiling but the error was still there. So what you're saying is the only way to resolve these "standard" unit names in RAD Studio 2010 is I would have to go through this exercise project's and ALL DUnitX's source files and get rid of "System." from their uses lines. Emm..... not sure I wanna do all that especially in someone else's code. As for the DUnitX units unable to be resolved $(DUNITX) was never in project search path originally when I downloaded this exercise project. Only when I added it to Library Path for Delphi Library - Win32 did it get inherited into project search path. When I removed it from this library path it got removed from project's search path. When I then added $(DUNITX) to the project's search path and compiled I still got same errors. So I think I'll try Delphi Community Edition to avoid these issues. The only reason I'm using 2010 is my employer is using it but since I want to only run these exercism.io Delphi examples to learn the language I guess I could do it in the free Community Edition. Is it the same version as the latest payed one (10.3.3) just without some additional features?
×