Database Automation Testing Framework

Database Automation Testing Framework

Hi,

So in my learning journey of Python & Robot Framework I have created many framework related to Web application GUI testing now it's time to create database testing framework. Before jumping into framework let's talk about database testing. Database testing consist following things (According to me):

1. Schema or Structure Testing: This involves structure of database validation. ex: destination database should have same number of tables with it's structure as source database.

2. Data Validation: This involves actual data testing which means destination database data should equally match with source database data.

3. Non-functional Testing: This involves load, stress or you can say performance testing, which basically test how much time it takes to connect to database and how much time it takes to execute query to database.

First let's list out tools which I have used to build this framework.

1. Pandas : To read excel sheet.

2. Robot Framework

3. Microsoft Excel

4. PyCharm IDE

So my framework is basically doing data validation. I have created excel sheet where I have listed queries which need to be fire on databases which will act like a test input data for this framework.

In this framework I am comparing two databases which are in my PostgreSQL RDBMS.

Now let's see the structure of the framework.

CustomLib folder contains Python script which contains functions to read excel sheet content. Results folder is a place where Robot Framework store the result of the execution. TestInputData.Robot file contains keyword related to excel sheet content. MainTestFile.Robot file contains main Robot Framework case.

So following is the flow of my framework:

1. First Framework gather content from excel sheet and store it in list variables.

2. Then First database activity will start.

3. First step will be connect to database

4. Get query and execute on database

5. Then query result store it in CSV file.

6. Then disconnect from database.

7. Steps 2 to 6 are same for second database.

8. Then comparing two CSV files using diff library.

9. Then removing those CSV files.

Here is the Robot Framework report snapshot.

If there is a difference in the file then it will be logged in reports. This framework will compare two databases. Queries listed in excel sheet should have same column in both databases. I have not yet tested with large data set therefore not sure about data limitation. You will find this framework in my GitHub repository.

Cheers!!

To view or add a comment, sign in

More articles by Ameya N.

  • Contract Testing 101

    Most distributed systems do not fail because of business logic. They fail because services do not agree on how they…

  • Postman → k6 Action v1.0.1 is LIVE (now with AI doing the boring bits)

    It’s been just 2 weeks since launch, and I’ve already shipped an upgrade. Less manual work.

  • Automating Bug Reproduction with LLM, Playwright, and Python: A Practical Experiment

    Why I Built This Reproducing bugs is one of the most repetitive and time-consuming parts of software development and…

  • From Prompting to Engineering: Designing Better Interactions with LLMs

    We’ve all been there — you ask something from an LLM, hoping for brilliance, but the output misses the mark. It’s not…

    3 Comments
  • My Epic AWS India Summit 2025 Adventure in Mumbai!

    So..

    3 Comments
  • APIGenie

    🚀 Exciting News for Developers and QA Professionals! 🌟 I am thrilled to introduce APIGenie, a powerful and versatile…

    1 Comment
  • URIBook

    Hello Friends, I am thrilled to announce the launch of URIBook, a Google Chrome Extension designed to revolutionize how…

    5 Comments
  • API Testing with my Excel Tool

    Hi, Well API is not new for me In my GIS days I have worked with several APIs. So naturally, I have very good hands on…

    47 Comments
  • Find_And_Replace

    Hi All, The Robot Framework is moving towards RPA (Robotics Process Automation) which is kind of cool. The Common use…

    2 Comments
  • compare-screenshots

    Hi All, One of my managers asked me "Can we do visual testing using Robot Framework ?" well, I said I don't know, give…

    8 Comments

Others also viewed

Explore content categories