MarketSquare / MarketSquare/Robotframework-Database-Library

New keyword "Compare Query Results"

Open
#251 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

improvement
Dominant language
Python
Stars
179
Forks
178
PR merge metrics
No merged PRs in 30d

Description

The keyword should compare results of two SQL queries and show the difference.

The arguments would be like ``query_1``, ``query_2`` and ``assert_results_equal`` (_True_ or _False_).
If _False_, there is no assertion - just show print the difference in the RF log.

Both queries must deliver the same columns - same numbers and the same names.
It has to be implemented in the queries themselves.

## The output should look like a merged table
- The columns are the same, they're merged (no duplicated cols like _Col_A_Query_1_ and _Col_A_Query_2_ - just _Col_A_).
- The cells with not equal values should get a red background and contain both values like ``Value 1 != Value 2``.
- The column name and the row number with a cell with unequal values shall be highlighted as well.
- And maybe keep them visible during the scrolling (sticky scroll)?
- All other cells with equal values should be either not highlighted at all or get a green background maybe.

## Apart from the visual highlighting, there should be an assertion to provide the keyword status and the error message
- The error message should not include all details, but maybe a number of rows and column names? Like this: _X rows had differences in cols A, B and C_?

## The very first check though should be the comparison of row number in results
- If they are unequal, there should be an error message (without details) - and an additional visual output.
- Visually, it would be maybe nice to print both tables aside and highlight rows, which exist in one of the results only - in green and red, like git merge style?
- No further assertions are performed in this case.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating the existing query-related keywords and their tests, then clarify row ordering, row-count mismatches, output formatting, and assertion behavior. Done means the comparison keyword, error reporting, and visual difference output have defined behavior for equal and unequal results.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sql
Domain
database, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.