11-19-2021, 10:21 AM
Thanks very much for your support. All issues have been fixed, the generate DUnit Test project compiles and runs without AV. The only thing about the generated code is that you cannot call Free (of the Session) in the Test method, but must delay that until the TearDown method:
type
TIWTestCase1 = class(TTestCase)
private
Session: TIWTestApplication;
...
procedure TIWTestCase1.SetUp;
begin
// Setup
Session := NewSession();
end;
procedure TIWTestCase1.TearDown;
begin
// Clean up
Session.Free;
end;
procedure TIWTestCase1.Test;
begin
with Session.MainForm as TIWForm1 do
begin
// your testcode here...
end;
end;
type
TIWTestCase1 = class(TTestCase)
private
Session: TIWTestApplication;
...
procedure TIWTestCase1.SetUp;
begin
// Setup
Session := NewSession();
end;
procedure TIWTestCase1.TearDown;
begin
// Clean up
Session.Free;
end;
procedure TIWTestCase1.Test;
begin
with Session.MainForm as TIWForm1 do
begin
// your testcode here...
end;
end;

