- Notifications
You must be signed in to change notification settings - Fork0
Robot Framework Library for easy handling of tabular data formats such as CSV, Excel, Parquet, and more.
License
imbus/robotframework-tablelibrary
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Here you can find theKeyword Documentation generated bylibdoc.
TableLibrary is a Robot Framework library designed for easy handling of tabular data formats such asCSV,Excel,Parquet, and more.
It provides a unified interface forreading,modifying, andcreating tables directly within your Robot Framework tests.
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
- Supports formats like
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.
We have included a basic handling ofExcel 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 complexExcel features like e.g.Excel Sheets, etc...
You can install the library using the following command:
pip install robotframework-tablelibrary# 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 columnTables.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}${content} = Tables.Read Table ${CURDIR}${/}testdata${/}example_05.parquet${result} = BuiltIn.Evaluate "${content}[0][0]" == "_time"BuiltIn.Should Be True ${result}# Create some data which should be inserted into the new tableVAR @{headers} = name ageVAR @{person1} = Michael 34VAR @{person2} = John 19# Create empty table object - internally in cache${uuid} = Tables.Create Table headers=${headers}# Append some rowsTables.Append Row ${person1}Tables.Append Row ${person2}Count Table ${uuid} Rows equal ${3}# Append a columnVAR @{column1} = city MG ERLTables.Append Column ${column1}Count Table ${uuid} Columns equal ${3}# Optional: Set new table cell valueGet Table Cell 1 1 equals 34Tables.Set Table Cell 25 0 1Get Table Cell 1 1 equals 25# Insert a new row into the existing table objectVAR @{insert_row} = Lu 26 HamburgInsert Row ${insert_row} 0Get Table Cell 1 0 equals LuCount Table ${uuid} Rows equal ${4}# Generate new headers which should be used in the tableVAR @{headers} = name age# Create new table object${uuid} = Create Table ${headers}# Generate some random data & append as rows to new tableFOR ${_} 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 objectCount Table ${uuid} Rows equals ${101}# Write table to specific file path -> write from cache into persistant fileWrite 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}SeeDevelopment.md for more information about contributing & developing this library.
robotframework-tablelibrary is distributed under the terms of theApache License 2.0 license.
About
Robot Framework Library for easy handling of tabular data formats such as CSV, Excel, Parquet, and more.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.