fpc/packages/fcl-db/tests/dbtestframework.pas
reiniero 669a16c98d sqldb/tests improvements:
* fix memory leak in gui runner
sqldb/tests for dbf/tdbf/dbase/foxpro unit:
* added dbf specific tests
* specify desired tablelevel by connectorparams=<tablelevel> (e.g. 4 for DBase IV)
* dbftoolsunit set up similar to bufdataset tools unit including autocleaning files
- dbname= field in database.ini no longer used for dbf files; always write to temp directory
To do: go through other tests and add ignores if necessary for non-relevant tests

git-svn-id: trunk@24104 -
2013-04-01 10:38:23 +00:00

85 lines
1.8 KiB
ObjectPascal

program dbtestframework;
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
SysUtils,
fpcunit, testreport, testregistry,
DigestTestReport,
toolsunit,
// List of supported database connectors
sqldbtoolsunit,
dbftoolsunit,
bufdatasettoolsunit,
memdstoolsunit,
SdfDSToolsUnit,
tcsdfdata,
// Units wich contain the tests
TestBasics,
TestFieldTypes,
TestDatasources,
TestDBBasics,
TestBufDatasetStreams,
TestSpecificTBufDataset,
TestSpecificTDBF,
TestDBExport,
consoletestrunner;
Procedure LegacyOutput;
var
FXMLResultsWriter: TXMLResultsWriter;
FDigestResultsWriter: TDigestResultsWriter;
testResult: TTestResult;
begin
testResult := TTestResult.Create;
FXMLResultsWriter := TXMLResultsWriter.Create;
FDigestResultsWriter := TDigestResultsWriter.Create(nil);
try
testResult.AddListener(FXMLResultsWriter);
testResult.AddListener(FDigestResultsWriter);
FDigestResultsWriter.Comment:=dbtype;
FDigestResultsWriter.Category:='DB';
FDigestResultsWriter.RelSrcDir:='fcl-db';
FXMLResultsWriter.WriteHeader;
// FdiDBResultsWriter.OpenConnection(dbconnectorname+';'+dbconnectorparams);
GetTestRegistry.Run(testResult);
FXMLResultsWriter.WriteResult(testResult);
finally
testResult.Free;
FXMLResultsWriter.Free;
FDigestResultsWriter.Free;
end;
end;
Var
Application : TTestRunner;
begin
InitialiseDBConnector;
Try
Application:=TTestRunner.Create(nil);
With Application do
try
if HasOption('g','legacy') then
LegacyOutput
else
begin
DefaultFormat:=fplain;
DefaultRunAllTests:=True;
Initialize;
Run;
end;
finally
Free;
end;
Finally
FreeDBConnector;
end;
end.