|
| 1 | +program DUnitXExamples_D11Alexandria; |
| 2 | + |
| 3 | +{$APPTYPE CONSOLE} |
| 4 | + |
| 5 | +uses |
| 6 | + System.SysUtils, |
| 7 | + DUnitX.Examples.General in 'DUnitX.Examples.General.pas', |
| 8 | + DUnitX.ConsoleWriter.Base in '..\Source\DUnitX.ConsoleWriter.Base.pas', |
| 9 | + DUnitX.DUnitCompatibility in '..\Source\DUnitX.DUnitCompatibility.pas', |
| 10 | + DUnitX.Generics in '..\Source\DUnitX.Generics.pas', |
| 11 | + DUnitX.InternalInterfaces in '..\Source\DUnitX.InternalInterfaces.pas', |
| 12 | + DUnitX.IoC in '..\Source\DUnitX.IoC.pas', |
| 13 | + DUnitX.Loggers.Console in '..\Source\DUnitX.Loggers.Console.pas', |
| 14 | + DUnitX.Loggers.Text in '..\Source\DUnitX.Loggers.Text.pas', |
| 15 | + DUnitX.Loggers.XML.NUnit in '..\Source\DUnitX.Loggers.XML.NUnit.pas', |
| 16 | + DUnitX.Loggers.XML.xUnit in '..\Source\DUnitX.Loggers.XML.xUnit.pas', |
| 17 | + DUnitX.MacOS.Console in '..\Source\DUnitX.MacOS.Console.pas', |
| 18 | + DUnitX.Test in '..\Source\DUnitX.Test.pas', |
| 19 | + DUnitX.TestFixture in '..\Source\DUnitX.TestFixture.pas', |
| 20 | + DUnitX.TestFramework in '..\Source\DUnitX.TestFramework.pas', |
| 21 | + DUnitX.TestResult in '..\Source\DUnitX.TestResult.pas', |
| 22 | + DUnitX.RunResults in '..\Source\DUnitX.RunResults.pas', |
| 23 | + DUnitX.TestRunner in '..\Source\DUnitX.TestRunner.pas', |
| 24 | + DUnitX.Utils in '..\Source\DUnitX.Utils.pas', |
| 25 | + DUnitX.Utils.XML in '..\Source\DUnitX.Utils.XML.pas', |
| 26 | + DUnitX.WeakReference in '..\Source\DUnitX.WeakReference.pas', |
| 27 | + DUnitX.Windows.Console in '..\Source\DUnitX.Windows.Console.pas', |
| 28 | + DUnitX.StackTrace.EurekaLog7 in '..\Source\DUnitX.StackTrace.EurekaLog7.pas', |
| 29 | + NonNamespacedExample in 'NonNamespacedExample.pas', |
| 30 | + DUnitX.Examples.EqualityAsserts in 'DUnitX.Examples.EqualityAsserts.pas', |
| 31 | + DUnitX.FixtureResult in '..\Source\DUnitX.FixtureResult.pas', |
| 32 | + DUnitX.Loggers.Null in '..\Source\DUnitX.Loggers.Null.pas', |
| 33 | + DUnitX.MemoryLeakMonitor.Default in '..\Source\DUnitX.MemoryLeakMonitor.Default.pas', |
| 34 | + DUnitX.Extensibility in '..\Source\DUnitX.Extensibility.pas', |
| 35 | + DUnitX.CommandLine.OptionDef in '..\Source\DUnitX.CommandLine.OptionDef.pas', |
| 36 | + DUnitX.CommandLine.Options in '..\Source\DUnitX.CommandLine.Options.pas', |
| 37 | + DUnitX.CommandLine.Parser in '..\Source\DUnitX.CommandLine.Parser.pas', |
| 38 | + DUnitX.FixtureProviderPlugin in '..\Source\DUnitX.FixtureProviderPlugin.pas', |
| 39 | + DUnitX.Timeout in '..\Source\DUnitX.Timeout.pas', |
| 40 | + DUnitX.Attributes in '..\Source\DUnitX.Attributes.pas', |
| 41 | + DUnitX.Linux.Console in '..\Source\DUnitX.Linux.Console.pas', |
| 42 | + ProviderExample in 'ProviderExample.pas'; |
| 43 | + |
| 44 | +var |
| 45 | + runner : ITestRunner; |
| 46 | + results : IRunResults; |
| 47 | + logger : ITestLogger; |
| 48 | + nunitLogger : ITestLogger; |
| 49 | +begin |
| 50 | + try |
| 51 | + //Create the runner |
| 52 | + runner := TDUnitX.CreateRunner; |
| 53 | + runner.UseRTTI := True; |
| 54 | + |
| 55 | + //tell the runner how we will log things |
| 56 | + |
| 57 | + if TDUnitX.Options.ConsoleMode <> TDunitXConsoleMode.Off then |
| 58 | + begin |
| 59 | + logger := TDUnitXConsoleLogger.Create(TDUnitX.Options.ConsoleMode = TDunitXConsoleMode.Quiet); |
| 60 | + runner.AddLogger(logger); |
| 61 | + end; |
| 62 | + |
| 63 | + nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile); |
| 64 | + runner.AddLogger(nunitLogger); |
| 65 | + |
| 66 | + //Run tests |
| 67 | + results := runner.Execute; |
| 68 | + |
| 69 | + System.Write('Done.. press <Enter> key to quit.'); |
| 70 | + System.Readln; |
| 71 | + except |
| 72 | + on E: Exception do |
| 73 | + System.Writeln(E.ClassName, ': ', E.Message); |
| 74 | + end; |
| 75 | +end. |
0 commit comments