Abstract
This document describes how to set up the ZEOS Build & Test environment and shows how to compile gui and console based test applications to test the ZEOSLib code. It also describes the setup that has to be made for testing the library with various databases.
Table of Contents
In order to run the tests for the ZEOSLib you have to be sure that you have insalled the following software on your system:
Delphi Compiler / IDE (min. professional versions 5, 6, 7 or 2005)
DUnit Xtreme testing framework for Delphi [ Homepage | Download Page]
Java Runtime Environment or SDK (Version 1.4.2) [Homepage | Download Page]
Jakarta Ant [Download Page | Download Page]
The supported SQL Servers you want to test with
Make sure that the environment variable JAVA_HOME is set to the directory where you installed the Java Runtine or SDK (e. g. JAVA_HOME = c:\java\j2sdk1.4.2_06).
Also set the environment variable ANT_HOME to the directory where you installed Jakarta ANT (e. g. ANT_HOME = C:\Programs\ANT).
Before you are able to start compiling the ZEOS test applications you have to configure the compiler environment. All settings for compiling building and testing are stored in a file called build.properties. To get this file just copy the build_template.properties file in build directory and name it build.properties. The build.properties file has four sections that are important for compiling the test applications: "common" and "compilers". There is another section that determines which tests will be executed by calling test.cmd batchfile. This section is not important for compiling tests but it will also be documented.
In a Windows environment it is recommended that you use double backslash as directory separator. "Normal" slash will work but causes some problems in a Delphi 9 environment. In a Unix / Linux environment it is recommended use the "normal" slash as direcrory separator.
The first section is the common-section it contains common informations for building the test applications:
[common] project.home=d:/workshop/zeosdbo_rework release.version =6.5.2-beta copy.verbose=false dunit.dir=d:/programme/borland/delphi7/dunit/src kunit.dir=
The second section is the compiler-section it contains informations about the active compilers to use for building the test applications. Each supported compiler has its own "section". It describes wether the compiler (prefix of the key (e. g. "delphi5")) is active and determines the installation directory of the compiler.
[compilers] delphi5.active=false delphi5.home=C:/Program Files/Borland/Delphi5 : delphi9.active=true delphi9.home=d:\\programme\\borland\\bds\\3.0 delphi9.bpl.dir=c:\\dokumente und einstellungen\\user\\eigene dateien\\borland studio-projekte\\bpl : kylix3.active=false kylix3.home=/opt/kylix3
This section is necessary to determine which tests will be run when executing the test.cmd batchfile (only makes sense when compiling the test applications as console applications).
[tests] test.core=true test.parsesql=true test.dbc=true test.component=true test.bugreport=true test.performance=false
It is possible to run the ZEOS tests for a number of SQL servers that are currently running on the test machine. Therefor the Build and Test Environment has to be configured.
Setting up the database parameters is done in the test.properites file that is located in the "database" direcory. To get this file just copy the test_template.properties file and rename it to test.properties and then make your settings.
At the moment we do not execute performance tests so only the common section and the database sections are of importance for testing the ZEOS Library.
The first section is the common-section it contains common informations about the databases to test by test applications:
[common] common.connections=sqlite28,firebird15
Corresponding to the active servers listed in the common.connections key (here: SQLite 2.8 and Firebird 1.5.x) there are configuration sections that contain the settings for running tests with the given database. Each section consists of the same keys so we will take the Firebird 1.5 database configuration to explain them:
[firebird15] firebird15.protocol=firebird-1.5 firebird15.alias=firebird_zeoslib firebird15.host=localhost firebird15.port= firebird15.database=d:\SQLServerFarm\Firebird\15\Data\zeoslib.fdb firebird15.user=SYSDBA firebird15.password=masterkey firebird15.rebuild=yes firebird15.delimiter.type=SetTerm firebird15.delimiter=; firebird15.create.scripts=create_interbase.sql,populate_any.sql,populate_interbase.sql,create_interbase_bugreport.sql (11) firebird15.drop.scripts=drop_interbase.sql,drop_interbase_bugreport.sql (12)
DBC protocol name | |
BDE alias for performance tests | |
Host name | |
Port number | |
Database name | |
User name | |
User password | |
User password | |
Flag to rebuild database before each test | |
SQL delimiter type in SQL scripts (Default, Go, SetTerm or EmptyLine) | |
SQL delimiter string | |
(11) | SQL scripts to create database objects. All scripts have to be placed in the "database" directory (where the test.properties file is located). |
(12) | SQL scripts to drop database objects. All scripts have to be placed in the "database" directory (where the test.properties file is located). |
Due to techniques used in the ZEOS Testframework classes it is necessary to set a prefix in front of the key that is identical to the section name followed by a dot. E. g.: firebird15.password - where "firebird15" is the repeated name of the section (see above).
When all the required Software is installed and you made the configurations that are necessary for your test environment you are ready to start compiling the test applications. This is easyly done by calling the batch script "compiletests.cmd" from commandline in "build" directory. When all applications are successfully compiled you are able to test ZEOSLib funcionality.
ZEOS BTE splits the tests into seven parts (separate applications):
Bug Report Tests (ZTestBugReport.EXE)
Component Tests (ZTestComponentAll.EXE)
Core Tests (ZTestCoreAll.EXE)
Database Connectivity (DBC) Tests (ZTestDbcAll.EXE)
SQL Parser Tests (ZTestParseSqlAll.EXE)
Performance Tests - currently not executed - (ZTestPerformance.EXE)
The applications listed above are compiled into the build directory of the corresponding package (e. g.: ...\packages\delphi7\build). Normally the applications are compiled to execute as console applications but if you want to run them as GUI applications just remove the comment from "{$DEFINE TESTGUI}" in the ZEOS.INC file. If you now call one of the test applications they are executed in a GUI. If you want to create console test applications you just have to comment the "{$DEFINE TESTGUI}" again (in ZEOS.INC).
As written in section "Compiling Tests", it is possible to execute special tests (e. g. only Bug Report Tests) by calling the EXE-file explicitly. Depending on the settings you will start one console application or one GUI application. You also may run all tests by running them sequentially via batch script (consider to compile all the tests as a console application!)
Before you run tests make sure that all the database servers you want to test are up and running!
To do run all tests (that are defined to run in section "tests" of the build.properties file), automatically, just type "test" from a commandline in "build" directory. The test result is output to screen and into a log file located in the "build" subdirectory "logs". The logfile is called "test-YYYYMMDD.log" where "YYYYMMDD" is the current date.