I am using Delphi 12.1 (trail) and have the following configuration:
program WalterNativeTests;
{$IFNDEF TESTINSIGHT}
{$APPTYPE CONSOLE}
{$ENDIF}
{$STRONGLINKTYPES ON}
uses
FastMM4,
DUnitX.MemoryLeakMonitor.FastMM4,
System.SysUtils,
{$IFDEF TESTINSIGHT}
TestInsight.DUnitX,
{$ELSE}
DUnitX.Loggers.Console,
DUnitX.Loggers.Xml.NUnit,
{$ENDIF }
DUnitX.TestFramework,
StringUtilsTest in 'StringUtilsTest.pas',
EncryptionTests in 'EncryptionTests.pas';
{ keep comment here to protect the following conditional from being removed by the IDE when adding a unit }
{$IFNDEF TESTINSIGHT}
var
runner: ITestRunner;
results: IRunResults;
logger: ITestLogger;
nunitLogger : ITestLogger;
{$ENDIF}
begin
{$IFDEF TESTINSIGHT}
TestInsight.DUnitX.RunRegisteredTests;
{$ELSE}
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;
//When true, Assertions must be made during tests;
runner.FailsOnNoAsserts := True;
//tell the runner how we will log things
//Log to the console window if desired
if TDUnitX.Options.ConsoleMode <> TDunitXConsoleMode.Off then
begin
logger := TDUnitXConsoleLogger.Create(TDUnitX.Options.ConsoleMode = TDunitXConsoleMode.Quiet);
runner.AddLogger(logger);
end;
//Generate an NUnit compatible XML File
nunitLogger := TDUnitXXMLNUnitFileLogger.Create(TDUnitX.Options.XMLOutputFile);
runner.AddLogger(nunitLogger);
TDUnitX.Options.ExitBehavior := TDUnitXExitBehavior.Pause;
TDUnitX.Options.ShowUsage := True;
//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;
{$ENDIF}
end.
Al my tests have asserts="0"
<test-case name="RoundTripTest" executed="True" result="Success" success="True" time="0.009" asserts="0"/>
what am I missing, I am sure I have more han zero asserts in the tests...
procedure EncyptionTest.RoundTripTest;
const password:string ='pa$$w0rd123';
const secret: string = 'This is a secret string that no one is allowed to be able to read';
var encrypted,decrypted:string;
begin
encrypted:= SymmetricEncrypt(password,11000,secret);
decrypted:= SymmetricDecrypt(password,11000,encrypted);
Assert.AreEqual(secret,decrypted);
Assert.AreNotEqual(encrypted,decrypted);
end;