I have used Status() method which will output the value when a failure occurs:
procedure Test.TestGetStringListQueryValuesException;
var
ReturnValue: TList<String>;
item: String;
begin
ReturnValue := FTest.GetStringListQueryValues;
try
for item in ReturnValue do
begin
Status('Value Processed: ' + item);
CheckTrue(Pos('B', item) > 0, 'Wrong Value, Expected Item containing ''B'' but found: ' + item);
end;
finally
ReturnValue.Free;
end;
end;
The result of that is somethig like this:
TestGetIntegerListQueryValuesException: ETestFailure
at $0050B842
Wrong Value, Expected > 50 and < 60 but found: 61, expected: <True> but was: <False>
Status Messages
Value Processed: 52
Value Processed: 54
Value Processed: 55
Value Processed: 58
Value Processed: 59
Value Processed: 61
It is really useful to identify what went wrong during the test.
I haven't tried the SetStatusListener() but I think it should be the correct way if we want to show logging when a test has succeeded.
I would like to mimic the same behaviour as per Nunit where you can log customised messages on the output section.
Any better ideas?