dbtestframework.pas 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. program dbtestframework;
  2. {$IFDEF FPC}
  3. {$mode objfpc}{$H+}
  4. {$ENDIF}
  5. {$APPTYPE CONSOLE}
  6. uses
  7. SysUtils,
  8. fpcunit, testreport, testregistry,
  9. ibase60dyn,
  10. DigestTestReport,
  11. toolsunit,
  12. // List of supported database connectors
  13. sqldbtoolsunit,
  14. dbftoolsunit,
  15. bufdatasettoolsunit,
  16. memdstoolsunit,
  17. SdfDSToolsUnit,
  18. tcsdfdata,
  19. // Units wich contain the tests
  20. TestBasics,
  21. TestDBBasics,
  22. TestFieldTypes,
  23. TestDatasources,
  24. TestBufDatasetStreams,
  25. TestSQLDB,
  26. TestSpecificTBufDataset,
  27. TestSpecificTDBF,
  28. TestSpecificTMemDataset,
  29. TestDBExport,
  30. consoletestrunner;
  31. Procedure LegacyOutput;
  32. var
  33. FXMLResultsWriter: TXMLResultsWriter;
  34. FDigestResultsWriter: TDigestResultsWriter;
  35. testResult: TTestResult;
  36. begin
  37. testResult := TTestResult.Create;
  38. FXMLResultsWriter := TXMLResultsWriter.Create;
  39. FDigestResultsWriter := TDigestResultsWriter.Create(nil);
  40. try
  41. testResult.AddListener(FXMLResultsWriter);
  42. testResult.AddListener(FDigestResultsWriter);
  43. FDigestResultsWriter.Comment:=dbtype;
  44. FDigestResultsWriter.Category:='DB';
  45. FDigestResultsWriter.RelSrcDir:='fcl-db';
  46. FXMLResultsWriter.WriteHeader;
  47. // FdiDBResultsWriter.OpenConnection(dbconnectorname+';'+dbconnectorparams);
  48. GetTestRegistry.Run(testResult);
  49. FXMLResultsWriter.WriteResult(testResult);
  50. finally
  51. testResult.Free;
  52. FXMLResultsWriter.Free;
  53. FDigestResultsWriter.Free;
  54. end;
  55. end;
  56. Var
  57. Application : TTestRunner;
  58. begin
  59. ibase60dyn.InitialiseIBase60('libfbclient.so.2.5.2');
  60. InitialiseDBConnector;
  61. Try
  62. Application:=TTestRunner.Create(nil);
  63. With Application do
  64. try
  65. if HasOption('g','legacy') then
  66. LegacyOutput
  67. else
  68. begin
  69. DefaultFormat:=fplain;
  70. DefaultRunAllTests:=True;
  71. Initialize;
  72. Run;
  73. end;
  74. finally
  75. Free;
  76. end;
  77. Finally
  78. FreeDBConnector;
  79. end;
  80. end.