Browse Source

+ Added a README and some examples do database.ini
* fixed compilation of dbtestframework.pas

git-svn-id: trunk@5753 -

joost 18 years ago
parent
commit
985043e871
4 changed files with 85 additions and 19 deletions
  1. 1 0
      .gitattributes
  2. 26 0
      fcl/dbtests/README.txt
  3. 55 8
      fcl/dbtests/database.ini
  4. 3 11
      fcl/dbtests/dbtestframework.pas

+ 1 - 0
.gitattributes

@@ -775,6 +775,7 @@ fcl/db/unmaintained/sqlite/Makefile.fpc -text
 fcl/db/unmaintained/sqlite/sqlitedataset.pas svneol=native#text/plain
 fcl/db/unmaintained/sqlite/sqlitedataset.pas svneol=native#text/plain
 fcl/dbtests/Makefile -text
 fcl/dbtests/Makefile -text
 fcl/dbtests/Makefile.fpc -text
 fcl/dbtests/Makefile.fpc -text
+fcl/dbtests/README.txt svneol=native#text/plain
 fcl/dbtests/database.ini -text
 fcl/dbtests/database.ini -text
 fcl/dbtests/dbftoolsunit.pas -text
 fcl/dbtests/dbftoolsunit.pas -text
 fcl/dbtests/dbtestframework.pas -text
 fcl/dbtests/dbtestframework.pas -text

+ 26 - 0
fcl/dbtests/README.txt

@@ -0,0 +1,26 @@
+This directory contains a framework to test several TDataset descendents.
+
+The framework is based on the fpcunit unit-test system. The tests can be
+executed using any fpcunit-testrunner. For example the console and graphical
+fpcunit-test runners from Lazarus.
+Simply add the test* units in this directory to the uses statement of the
+test-runner and all tests will get registered and executed.
+
+An simple test-runner (dbtestframework.pas) which generates XML-output is
+included in this directory.
+
+To test a TDataset descendent, a 'connector' is needed to test the database.
+To add a new connector, add it to the uses-section in 'toolsunit.pas'. Several
+connectors are available in the '*toolsunit.pas' files.
+
+Which connector is currently used is dependent on the 'database.ini'
+configuration file. Also some settings which are connector-dependent can be set
+in that file. See 'database.ini' for more information.
+
+I hope this is enough information to get you started,
+
+Joost van der Sluis (30-12-2006)
+
+
+
+

+ 55 - 8
fcl/dbtests/database.ini

@@ -1,40 +1,87 @@
 [Database]
 [Database]
-type=interbase
+; This file contains several sections, one for each database-type. Select here
+; which database has to be tested currently.
+type=dbf
 
 
+
+
+; These sections are for the several SQLDB-types of databases:
 [postgresql]
 [postgresql]
+; The connector specifies the connector that has to be used. The 'sql' connector
+; tests the TSQLQuery component
 connector=sql
 connector=sql
+; Here you can give some parameters, which are specific for each connector. The
+; SQL connector uses this parameter to specify the connection that should be
+; used;
 connectorparams=postgresql
 connectorparams=postgresql
+; The name of the database. The database could be empty. You only need read and
+; write rights.
 name=testdb
 name=testdb
+; user to log in with
 user=
 user=
+; password to log in with
 password=
 password=
+; hostname of the database-server
 hostname=
 hostname=
 
 
 [mysql40]
 [mysql40]
 connector=sql
 connector=sql
 connectorparams=mysql40
 connectorparams=mysql40
-name=cnoc02
+name=testdb
+user=root
+password=apassword
+hostname=192.168.1.1
+
+[mysql41]
+connector=sql
+connectorparams=mysql41
+name=testdb
 user=root
 user=root
-password=rosivrepus
-hostname=192.168.3.1
+password=apassword
+hostname=192.168.1.1
+
+[mysql50]
+connector=sql
+connectorparams=mysql50
+name=testdb
+user=root
+password=apassword
+hostname=192.168.1.1
 
 
 [oracle]
 [oracle]
 connector=sql
 connector=sql
 connectorparams=oracle
 connectorparams=oracle
 name=xe
 name=xe
 user=system
 user=system
-password=rosivrepus
-hostname=192.168.3.1
+password=apassword
+hostname=192.168.1.1
 
 
 [interbase]
 [interbase]
 connector=sql
 connector=sql
 connectorparams=interbase
 connectorparams=interbase
-name=/opt/firebird/examples/employee.fdb
+name=/path/to/database.fdb
 user=sysdba
 user=sysdba
-password=rosivrepus
+password=masterkey
+hostname=192.168.1.1
+
+[odbc]
+connector=sql
+connectorparams=odbc
+name=testdb
+user=root
+password=apassword
+hostname=192.168.1.1
 
 
+
+
+; This section is for TDbf:
 [dbf]
 [dbf]
 connector=dbf
 connector=dbf
+; Give here the path where the *.dbf file can be generated
 name=/tmp
 name=/tmp
 
 
+
+
+; This section is for MemDS:
 [memds]
 [memds]
 connector=memds
 connector=memds

+ 3 - 11
fcl/dbtests/dbtestframework.pas

@@ -4,21 +4,13 @@ program dbtestframework;
   {$mode objfpc}{$H+}
   {$mode objfpc}{$H+}
 {$ENDIF}
 {$ENDIF}
 
 
-{$include settings.inc}
-
 {$APPTYPE CONSOLE}
 {$APPTYPE CONSOLE}
 
 
 uses
 uses
   SysUtils,
   SysUtils,
-  fpcunit,testregistry,
-  testbasics, toolsunit,
-{$ifdef SQLDB_AVAILABLE}
-  testsqlfieldtypes,
-{$ENDIF}
-{$IFDEF DBF_AVAILABLE}
-  testdbbasics,
-{$ENDIF}
-  testreport;
+  fpcunit, testregistry, testreport,
+  toolsunit,
+  testbasics, testsqlfieldtypes, testdbbasics;
   
   
 var
 var
   FXMLResultsWriter: TXMLResultsWriter;
   FXMLResultsWriter: TXMLResultsWriter;