2015-12-22 12:29:25 +01:00
|
|
|
program DMVCFrameworkTests;
|
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
{$IFNDEF TESTINSIGHT}
|
2015-12-22 12:29:25 +01:00
|
|
|
{$APPTYPE CONSOLE}
|
2017-08-20 02:36:22 +02:00
|
|
|
{$ENDIF}{$STRONGLINKTYPES ON}
|
2016-08-24 16:08:18 +02:00
|
|
|
|
2015-12-22 12:29:25 +01:00
|
|
|
uses
|
2017-08-20 02:36:22 +02:00
|
|
|
System.SysUtils,
|
|
|
|
{$IFDEF TESTINSIGHT}
|
|
|
|
TestInsight.DUnitX,
|
|
|
|
{$ENDIF }
|
|
|
|
DUnitX.Loggers.Console,
|
2018-08-08 17:11:45 +02:00
|
|
|
DUnitX.Loggers.GUIX,
|
2017-08-20 02:36:22 +02:00
|
|
|
DUnitX.Loggers.Xml.NUnit,
|
|
|
|
DUnitX.TestFramework,
|
2015-12-22 12:29:25 +01:00
|
|
|
FrameworkTestsU in 'FrameworkTestsU.pas',
|
|
|
|
LiveServerTestU in 'LiveServerTestU.pas',
|
|
|
|
MessagingExtensionsTestU in 'MessagingExtensionsTestU.pas',
|
|
|
|
BOs in 'BOs.pas',
|
|
|
|
TestServerControllerU in '..\TestServer\TestServerControllerU.pas',
|
2016-05-19 11:22:55 +02:00
|
|
|
RESTAdapterTestsU in 'RESTAdapterTestsU.pas',
|
2017-05-25 16:57:49 +02:00
|
|
|
MVCFramework.Tests.WebModule2 in '..\StandaloneServer\MVCFramework.Tests.WebModule2.pas' {TestWebModule2: TWebModule},
|
2016-11-13 20:59:21 +01:00
|
|
|
MVCFramework.Tests.StandaloneServer in '..\StandaloneServer\MVCFramework.Tests.StandaloneServer.pas',
|
2017-05-25 16:57:49 +02:00
|
|
|
MVCFramework.Tests.WebModule1 in '..\RESTClient\MVCFramework.Tests.WebModule1.pas' {TestWebModule1: TWebModule},
|
2016-11-13 20:59:21 +01:00
|
|
|
MVCFramework.Tests.RESTClient in '..\RESTClient\MVCFramework.Tests.RESTClient.pas',
|
2017-02-07 14:08:36 +01:00
|
|
|
MVCFramework.Tests.AppController in '..\RESTClient\MVCFramework.Tests.AppController.pas',
|
2017-04-26 14:39:18 +02:00
|
|
|
BusinessObjectsU in '..\..\..\samples\commons\BusinessObjectsU.pas',
|
2017-05-25 16:57:49 +02:00
|
|
|
MVCFramework.SystemJSONUtils in '..\..\..\sources\MVCFramework.SystemJSONUtils.pas',
|
2017-09-08 16:59:02 +02:00
|
|
|
MVCFramework.Serializer.Commons in '..\..\..\sources\MVCFramework.Serializer.Commons.pas',
|
2017-09-24 19:40:40 +02:00
|
|
|
MVCFramework.Patches in '..\..\..\sources\MVCFramework.Patches.pas',
|
|
|
|
JSONRPCTestsU in 'JSONRPCTestsU.pas',
|
|
|
|
MVCFramework.JSONRPC in '..\..\..\sources\MVCFramework.JSONRPC.pas';
|
2015-12-22 12:29:25 +01:00
|
|
|
|
|
|
|
{$R *.RES}
|
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
var
|
|
|
|
runner : ITestRunner;
|
|
|
|
results : IRunResults;
|
|
|
|
logger : ITestLogger;
|
|
|
|
nunitLogger : ITestLogger;
|
2015-12-22 12:29:25 +01:00
|
|
|
begin
|
|
|
|
ReportMemoryLeaksOnShutdown := True;
|
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
{$IFDEF TESTINSIGHT}
|
|
|
|
TestInsight.DUnitX.RunRegisteredTests;
|
|
|
|
exit;
|
|
|
|
{$ENDIF}
|
2017-04-29 23:56:56 +02:00
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
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);
|
|
|
|
runner.AddLogger(nunitLogger);
|
|
|
|
runner.FailsOnNoAsserts := False; //When true, Assertions must be made during tests;
|
2017-04-29 23:56:56 +02:00
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
//Run tests
|
|
|
|
results := runner.Execute;
|
|
|
|
if not results.AllPassed then
|
|
|
|
System.ExitCode := EXIT_ERRORS;
|
2016-08-24 16:08:18 +02:00
|
|
|
|
2017-08-20 02:36:22 +02:00
|
|
|
{$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;
|
2015-12-22 12:29:25 +01:00
|
|
|
end.
|