Database Library for Robot Framework

2.4.1 · active · verified Tue Apr 14

The Database Library for Robot Framework allows users to query databases and verify results within Robot Framework tests. It is currently at version 2.4.1 and maintains an active release cadence, with frequent minor and patch updates to introduce new features, fix bugs, and enhance compatibility.

Warnings

Install

Imports

Quickstart

This example demonstrates connecting to an in-memory SQLite database, creating a table, inserting data, querying it, and asserting results using various keywords. It highlights the basic workflow without requiring external database setup beyond the library itself, as `sqlite3` is a built-in Python module.

*** Settings ***
Library    DatabaseLibrary

*** Test Cases ***
Example Database Interaction
    Connect To Database    sqlite3    :memory:
    Execute SQL String    CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)
    Execute SQL String    INSERT INTO users (name) VALUES ('Alice')
    Execute SQL String    INSERT INTO users (name) VALUES ('Bob')
    ${result}=    Query    SELECT name FROM users WHERE id = 1
    Check Query Result    SELECT name FROM users WHERE id = 1    equals    Alice
    Check Row Count    SELECT * FROM users    ==    2
    Disconnect From Database

view raw JSON →