Accenture / DBTestCompare

Application to compare results of two SQL queries
MIT License
25 stars 12 forks source link
compare-data database database-migrations jdbc-drivers mariadb mysql postgresql snowflake sql-queries sqlserver teamcity teradata testng tests
DBTestCompare

Application to compare results of two SQL queries

DBTestCompare Build

It reads tests definitions in XML format form specified directory and than runs them (as TestNG test).

You can generate automated tests for your database using DBTestCompareGenerator

If two SQL returns different results -> test fails.

Application supports TeamCity Service Messages (##teamcity messages) so if teamcityLogsEnabled is set to "true" (config file or command line parameter), you will see nice test tree in TeamCity logs.

To execute tests run program (Java 8 must be installed first (JDK or JRE)):

If you set JAVA_HOME variable:

java -jar DBTestCompare-1.0-SNAPSHOT-jar-with-dependencies.jar

or to add automatically all drivers from the directory to the classspath (jdbc_drivers/*) Windows

java -cp "DBTestCompare-1.0-SNAPSHOT-jar-with-dependencies.jar;jdbc_drivers/*" uk.co.objectivity.test.db.RunTests

Linux

java -cp "DBTestCompare-1.0-SNAPSHOT-jar-with-dependencies.jar:jdbc_drivers/*" uk.co.objectivity.test.db.RunTests

or e.g.

"C:\Program Files\Java\jdk1.8.0_92\bin\java" -jar DBTestCompare-1.0-SNAPSHOT-jar-with-dependencies.jar

The application provides the following features:

How DBTestCompare works:

Comparing databases:

DBTestCompare

With test data delivered by file:

DBTestCompare

The program searches for test definitions by default in folder "test-definitions".

JDBC drivers must be present in "jdbc_drivers" folder. Licensed database drivers are NOT included, only open source like MySQL, MariaDB and PostgreSQL. Download licensed database drivers from the producer of the database e.g. Microsoft and put them in "jdbc_drivers" folder (on the same level as *.jar file).

More details here

You can override some of the application configuration properties, run app with:

-DtestsDir=path -set tests directory (default: test-definitions)

-DteamcityLogsEnabled=true -log test output in TeamCity format

-DfilterInclude=a.b,g.z.f -comma separated directories or test files which you want to include

-DfilterExclude=a.b.test -comma separated directories or test files which you want to exclude

for example:

java -DtestsDir=my_tests -jar DBTestCompare-1.0-SNAPSHOT-jar-with-dependencies.jar

More details here

3'rd party libraries: Software:

More details here

Where to start?


Checkout the code or get compiled jar file from releases page


To compile app to a runnable fat jar file, run (Maven must be installed first):

mvn clean compile assembly:single

jar will be created in target directory.


You can manage the application by attached ANT (ANT must be installed first) build.xml file (in folder \deploy), the script allows to :

-compile app

-replace tokens in connection definition

-replace tokens in SQL queries

more details here and here