I need to compare two databases which have many tables in it.
Both databases are the same but we are running different scripts to load and validate the data.
- How will i do this?
- Can I use Selenium?
I need to compare two databases which have many tables in it.
Both databases are the same but we are running different scripts to load and validate the data.
Liquibase is a tool that offers this kind of functionality among others, assuming you can establish jdbc connections to your databases.
There is a diff command that takes the connection parameters of 2 databases, and it reports their differences.
In order to report data changes you will need to use the --diffTypes=data
option.
Syntax:
liquibase.sh --driver=oracle.jdbc.OracleDriver \
--url=jdbc:oracle:thin:@testdb:1521:test \
--username=bob \
--password=bob \
diff \
--referenceUrl=jdbc:oracle:thin:@localhost/XE \
--referenceUsername=bob \
--referencePassword=bob
--diffTypes=data
Yes you might be able to use Selenium, if you can check it manually from the user interface and it is a web-application.
Not sure it is the fastest or easiest way to compare two databases though. Selenium is created for testing functional behaviour, not data validation.
Maybe it is easier to use a SQL compare tool, like this one: http://www.red-gate.com/products/sql-development/sql-compare/
To achieve the purpose there are many automation tools out there. I would suggest to use OATS tool (Oracle Application Testing Suite). I find it more comfortable than Selenium .
It has lot of inbuilt features. Functional Testing, Load Testing, Webservices, Data Base Testing.
To Compare two data bases is quite easy. Follow the link for more details information
https://chadthompson.me/2012/08/first-steps-with-oats-recording-a-test-with-openscript/
https://docs.oracle.com/cd/E25294_01/doc.920/e15487/chap3_os_fm.htm
If using MySQL you can use the mysql mysqldbcompare tool.
https://dev.mysql.com/doc/mysql-utilities/1.5/en/mysqldbcompare.html
This utility compares the objects and data from two databases to find differences. It identifies objects having different definitions in the two databases and presents them in a diff-style format of choice. Differences in the data are shown using a similar diff-style format. Changed or missing rows are shown in a standard format of GRID, CSV, TAB, or VERTICAL.
Use the notation db1:db2 to name two databases to compare, or, alternatively just db1 to compare two databases with the same name. The latter case is a convenience notation for comparing same-named databases on different servers.