Skip to main content

A Robot Framework library providing generic table keywords for several table file type like csv or excel.

Project description

RobotFramework Table Library

Statistics

Latest Build Status -  Branch Latest Build Status - Default Branch PyPI - Version PyPI - Python Version PyPI Downloads - Total PyPI Downloads - Monthly

Keyword Documentation

Here you can find the Keyword Documentation generated by libdoc.

📊 RobotFramework TableLibrary

TableLibrary is a Robot Framework library designed for easy handling of tabular data formats such as CSV, Excel, Parquet, and more.
It provides a unified interface for reading, modifying, and creating tables directly within your Robot Framework tests.

🔍 Key Features

  • Read Tables

    • Supports formats like .csv, .xlsx, .xls, .parquet, .json, .txt (as csv), and more.
    • Access table contents by column name or index.
    • Verifying specific table cells, columns or rows & executing assertions using the robotframework-assertion-engine
  • Modify Existing Tables

    • Add, remove, or update rows and columns.
    • Apply dynamic modifications during test execution.
  • Create New Tables

    • Create tables from lists, dictionaries, or other data sources.
    • Export tables to multiple file formats (e.g., CSV, Excel, Parquet).
    • Easily generate structured test data in the given file format.

Exception: Excel File Handling

We have included a basic handling of Excel files, but for more complex excel features, please take a look at the following library: robotframework-excelsage

This library got especially written to work with more complex Excel features like e.g. Excel Sheets, etc...

Installation

You can install the library using the following command:

pip install robotframework-tablelibrary

Example

File Format - CSV

# Reading CSV file with header column
${content} =    Tables.Read Table    ${CURDIR}${/}testdata${/}example_01.csv
${result} =    BuiltIn.Evaluate    "${content}[0][0]" == "index"
BuiltIn.Should Be True    ${result}
# Reading CSV file without header column
Tables.Configure Ignore Header    True
${content} =    Tables.Read Table    ${CURDIR}${/}testdata${/}example_01.csv
${result} =    BuiltIn.Evaluate    "index" not in "${content}"
BuiltIn.Should Be True    ${result}

File Format - Parquet

${content} =    Tables.Read Table    ${CURDIR}${/}testdata${/}example_05.parquet
${result} =    BuiltIn.Evaluate    "${content}[0][0]" == "_time"
BuiltIn.Should Be True    ${result}

Create new empty table - don't save to file system

# Create some data which should be inserted into the new table
VAR    @{headers} =    name    age
VAR    @{person1} =    Michael    34
VAR    @{person2} =    John    19

# Create empty table object - internally in cache
${uuid} =    Tables.Create Table    headers=${headers}

# Append some rows
Tables.Append Row    ${person1}
Tables.Append Row    ${person2}
Count Table    ${uuid}    Rows    equal    ${3}

# Append a column
VAR    @{column1} =    city    MG    ERL
Tables.Append Column    ${column1}
Count Table    ${uuid}    Columns    equal    ${3}

# Optional: Set new table cell value
Get Table Cell    1    1    equals    34
Tables.Set Table Cell    25    0    1
Get Table Cell    1    1    equals    25

# Insert a new row into the existing table object
VAR    @{insert_row} =    Lu    26    Hamburg
Insert Row    ${insert_row}    0
Get Table Cell    1    0    equals    Lu
Count Table    ${uuid}    Rows    equal    ${4}

Create new empty table - save to file system

# Generate new headers which should be used in the table
VAR    @{headers} =    name    age

# Create new table object
${uuid} =    Create Table    ${headers}

# Generate some random data & append as rows to new table
FOR    ${_}    IN RANGE    ${100}
    ${a} =    Generate Random String
    ${b} =    Generate Random String
    VAR    @{data}    ${a}    ${b}
    Tables.Append Row    ${data}
END

# Ensure that data got written into internal table object
Count Table    ${uuid}    Rows    equals    ${101}

# Write table to specific file path -> write from cache into persistant file
Write Table    ${uuid}    ${CURDIR}/results/test_writer_new_table.csv

# Check table content again, but now read table from file path!
Count Table    ${CURDIR}/results/test_writer_new_table.csv    Rows    equals    ${101}

Contribution & Development

See Development.md for more information about contributing & developing this library.

License

robotframework-tablelibrary is distributed under the terms of the Apache License 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_tablelibrary-0.1.3.tar.gz (98.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_tablelibrary-0.1.3-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_tablelibrary-0.1.3.tar.gz.

File metadata

File hashes

Hashes for robotframework_tablelibrary-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4ef13c31917d26103bcef66ae1dd127f0d1a8f4759237b13da52b58a29c9a380
MD5 e41c90328e70159ece7bf43b8eb26ed8
BLAKE2b-256 43ae8224ffe99cb9839858d242590c12e5abbabccd0eabae020c343751bc8463

See more details on using hashes here.

File details

Details for the file robotframework_tablelibrary-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_tablelibrary-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d04ba58dc44f2ff97a99ef459e5b457410a04fd9899b796808526c6c23e04ef6
MD5 b47e449ab4e4357ac2072b9bf3e9b6c2
BLAKE2b-256 178efaeb53b7f570756c5fbf8dbe985a8862f8832983cb0ffc3749e70c3ff788

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page