===================
DataComparerLibrary
===================
.. contents::
:local:
Preparation
===================
Installation
------------
If you already have Python with `pip <https://pip.pypa.io>`_ installed,
you can simply run::
pip install DataComparerLibrary
pip install --upgrade DataComparerLibrary
Also the following pip package is needed::
pip install python-dateutil
Import statement for the DataComparerLibrary in Python
------------------------------------------------------
from DataComparerLibrary.datacomparer import DataComparer
DataComparer
============
Introduction
------------
The DataComparerLibrary can be used for:
- comparing csv-files or text-files
- comparing a 2d-matrix with a csv-file or text-file
- comparing a csv-file or text-file with a 2d-matrix
- comparing 2d-matrices
| In case a difference between actual and expected data is found an exception wil be given. In Robot Framework
the result will be set to failed.
| A strait comparison can be made, but the DataComparerLibrary offers also some special comparison options described
beneath.
|
| {PRESENT}:
| With {PRESENT} in the expected data file you can make clear that data of a field/cell of the actual data should be present.
This can be helpful for fields that have constant changing values. For example generated id's.
|
| {EMPTY}:
| With {EMPTY} in the expected data file you can make clear that data of a field/cell of the actual data should be absent.
|
| {SKIP}:
| With {SKIP} in the expected data file you can make clear that the comparison of data of a field/cell or part of a field/cell
of the actual data should be skipped. This can be helpful for fields or parts of fields that have constant changing
values. For example time or generated id's.
|
| {INTEGER}:
| With {INTEGER} in the expected data file you can make clear that the data of a field/cell of the actual data should be an
integer. This can be helpful for fields that have constant changing integer values. For example integer id's.
|
| {NOW()...:....}:
| With {NOW()} in the expected data file you can make clear that the data of a field/cell or part of a field/cell of the actual
data should be (a part of) a date. You can let calculate the current or a date in the past or future. Calculation is
based on the "relativedelta" method from Python. Also you can style the date in the format you want. This can be
helpful for fields that have constant changing date values, but which date values have a fixed offset linked to the
current date. At "Examples comparing Actual Data with Expected Data" you can find some examples how to use it.
|
| {DATETIME_FORMAT():YYYYMMDDHHMMSSFF6}:
| With {DATETIME_FORMAT():YYYYMMDDHHMMSSFF6} in the expected data file you can make clear that the data of a field/cell or part of a field/cell of the actual
data should be (a part of) a date. At this moment it is processed as {SKIP}. In the future it will be changed into a check on date format, but
not a specific date. For check on a specific expected date you can use {NOW()...:....}.
|
|
| Delimiter:
| Default delimiter is "," in case of an input file. You can use the option "delimiter_actual_data" and "delimiter_expected_data" to set another
delimiter like ";" or "\t" for tab. It is also possible to use a multi-character delimiter like "@#@".
|
| Quotechar:
| Default quotechar is '"' in case of an input file. You can use the option "quotechar_actual_data" and/or "quotechar_expected_data" to set another
quotechar.
Comparing Data
--------------
Examples of using the DataComparerLibrary for comparing data in Python
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Below there are some examples how to call the methods of the DataComparerLibrary in Python::
a = DataComparer
a.compare_data_files(self, actual_file, expected_file)
a.compare_data_files(self, actual_file, expected_file, delimiter_actual_data=';', delimiter_expected_data=';')
a.compare_data_files(self, actual_file, expected_file, delimiter_actual_data='@#@', delimiter_expected_data='@#@')
a.compare_data_2d_array_with_file(self, actual_2d_matrix_data_input, expected_file, delimiter_expected_data='\t')
a.compare_data_file_with_2d_array(self, actual_file, expected_2d_matrix_data_input, delimiter_actual_data=';')
a.compare_data_2d_arrays(self, actual_2d_matrix_data_input, expected_2d_matrix_data_input)
Examples of using the DataComparerLibrary keywords for comparing data in Robot Framework
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
*** Settings ***
Library DataComparerLibrary
*** Test Cases ***
Testcase_DataComparer
Examples
*** Keywords ***
Examples
Run Keyword And Continue On Failure DataComparerLibrary.Compare Data Files C:\\Users\\actual.csv C:\\Users\\expected.csv
DataComparerLibrary.Compare Data Files C:\\Users\\actual.csv C:\\Users\\expected.csv delimiter_actual_data=; delimiter_expected_data=;
DataComparerLibrary.Compare Data Files C:\\Users\\actual.csv C:\\Users\\expected.csv delimiter_actual_data=@#@ delimiter_expected_data=@#@
DataComparerLibrary.Compare Data Files C:\\Users\\actual.csv C:\\Users\\expected.csv
DataComparerLibrary.Compare Data 2d Array With File ${actual_2d_matrix_data_input} C:\\Users\\expected.csv delimiter_expected_data=\t
DataComparerLibrary.Compare Data File With 2d Array C:\\Users\\actual.csv ${expected_2d_matrix_data_input} delimiter_actual_data=;
DataComparerLibrary.Compare Data 2d Arrays ${actual_2d_matrix_data_input} ${expected_2d_matrix_data_input}
Examples comparing Actual Data with Expected Data
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Below there is an example of actual and expected data with some different cases.
Based on current datetime = 2023-09-06 19:04:00 (example):
+--------------------------------------------------------------------------------------------------+
| Actual csv file or 2d-array |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| id | name | city | start datetime | code | password |
+==============+==========+==============+=================================+=========+=============+
| 87 | John | London | 2019-09-01 10:00:15 | abc1 | xxxxxxxx |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| 88 | Bert | Amsterdam | 2023/09/06 19:02:00 | | xxxxxxxx |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| 89 | Klaas | Brussel | 23-8-6 12:04:17 | 5ghi | xxxxxxxx |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| 90 | Joe | Helsinki | 08062025 12:04:17 | 99fg | xxxxxxxx |
+--------------+----------+--------------+---------------------------------+---------+-------------+
+--------------------------------------------------------------------------------------------------+
| Expected csv file or 2d-array |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| id | name | city | start datetime | code | password |
+==============+==========+==============+=================================+=========+=============+
| {INTEGER} | John | London | {NOW()-4Y5D:YYYY-MM-DD} | abc1 | {PRESENT} |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| {INTEGER} | Bert | Amsterdam | {NOW():YYYY/MM/DD} {SKIP} | {EMPTY} | {PRESENT} |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| {INTEGER} | Klaas | Brussel | {NOW()-1M:YY-M-D} {SKIP} | 5ghi | {PRESENT} |
+--------------+----------+--------------+---------------------------------+---------+-------------+
| {INTEGER} | Joe | Helsinki | {NOW()+1Y9M2D:DDMMYYYY} {SKIP} | {SKIP} | {PRESENT} |
+--------------+----------+--------------+---------------------------------+---------+-------------+
Comparing Text
--------------
Examples of using the DataComparerLibrary for comparing text in Python
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Below there are some examples how to call the methods of the DataComparerLibrary in Python::
a = DataComparer
a.compare_text_files(self, actual_file, expected_file)
a.compare_text_variable_with_text_file(self, actual_text_input, expected_file)
a.compare_text_file_with_text_variable(self, actual_file, expected_text_input)
a.compare_text_variables(self, actual_text_input, expected_text_input)
Examples of using the DataComparerLibrary keywords for comparing text in Robot Framework
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
*** Settings ***
Library DataComparerLibrary
*** Test Cases ***
Testcase_DataComparer
Examples
*** Keywords ***
Examples
Run Keyword And Continue On Failure DataComparerLibrary.Compare Text Files C:\\Users\\actual.txt C:\\Users\\expected.txt
DataComparerLibrary.Compare Text Files C:\\Users\\actual.txt C:\\Users\\expected.txt
DataComparerLibrary.Compare Text Files C:\\Users\\actual.txt C:\\Users\\expected.txt
DataComparerLibrary.Compare Text Files C:\\Users\\actual.txt C:\\Users\\expected.txt
DataComparerLibrary.Compare Text Variable With File ${actual_text_input} C:\\Users\\expected.txt
DataComparerLibrary.Compare Text File With Text Variable C:\\Users\\actual.txt ${expected_text_input}
DataComparerLibrary.Compare Text Variables ${actual_text_input} ${expected_text_input}
DataSorter
==========
Introduction
------------
The DataSorter can be used for sorting records in a csv file or text file.
Default sorting
---------------
The default sorting is alphabetically based in ascending order on column 0 on all records.
Special sorting
---------------
| With the DataSorter it is possible to tune the sorting of records.
|
| number_of_header_lines:
| Optional argument "number_of_header_lines" can be used to set the number of header records. These records will be excluded from sorting.
In case this optional argument is not present the default value is set to 0.
|
| number_of_trailer_lines:
| Optional argument "number_of_trailer_lines" can be used to set the number of trailer records. These records will be excluded from sorting.
In case this optional argument is not present the default value is set to 0.
|
| sort_on_columns_list:
| Optional argument "sort_on_columns_list" can be used to specify one or more columns on which should be sorted and in which order of columns.
Sorting of a column can be done in an alphabetic or numeric way.
|
| delimiter:
| Optional argument "delimiter" can be used to set the delimiter.
Default delimiter is "," in case of an input file. You can use the option "delimiter" to set another delimiter
like ";" or "\t" for tab. It is also possible to use a multi-character delimiter like "@#@".
Examples of using the DataComparerLibrary keywords for sorting data in Robot Framework
----------------------------------------------------------------------------------------
Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
*** Settings ***
Library DataComparerLibrary
*** Test Cases ***
Testcase_DataSorter
Examples
*** Keywords ***
Examples
# sorting examples
#
# Sorting alphabetic on column 0, 5 and 4
${sorting_column_0_5_4} = create list 0 5 4
# Sorting alphabetic on column 4 and 1 and numeric on colum 3
${sorting_column_4_3i_1} = create list 4 ${3} 1
Run Keyword And Continue On Failure DataComparerLibrary.Sort Csv Files C:\\Users\\unsorted.csv C:\\Users\\sorted.csv
DataComparerLibrary.Sort Csv Files C:\\Users\\unsorted.csv C:\\Users\\sorted.csv number_of_header_lines=5 sort_on_columns_list=${sorting_column_0_5_4} number_of_trailer_lines=5 delimiter=;
DataComparerLibrary.Sort Csv Files C:\\Users\\unsorted.csv C:\\Users\\sorted.csv number_of_header_lines=4 sort_on_columns_list=${sorting_column_4_3i_1} delimiter=@#@
DataComparerLibrary.Sort Csv Files C:\\Users\\unsorted.csv C:\\Users\\sorted.csv number_of_trailer_lines=2 delimiter=\t
DataComparerLibrary.Sort Csv Files C:\\Users\\unsorted.csv C:\\Users\\sorted.csv
FileConverter
=============
Introduction
------------
Records in files can be ended by carriage return line feed (CRLF). In some situations separate line feeds (LF) are
present within records. For example for an easy way of sorting records this can be a problem.
DataComparerLibrary keywords for preparing data in Robot Framework
------------------------------------------------------------------
The keywords "Remove Separate Lf" and "Replace Separate Lf" support removing/replacing a separate Lf in the data from
the input file. The result will be written to an output file.
Examples of using the DataComparerLibrary keywords for preparing data in Robot Framework
----------------------------------------------------------------------------------------
Below there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::
*** Settings ***
Library DataComparerLibrary
*** Test Cases ***
Testcase_FileConverter
Remove Separate LF From Data In File
Replace Separated LF With Character Or String From Data In File
*** Keywords ***
Remove Separate LF From Data In File
DataComparerLibrary.Remove Separate Lf ${path_actual_input_files}\\input_file_with_lf.txt ${path_actual_output_files}\\output_file_without_lf.txt
Replace Separated LF With Character Or String From Data In File
DataComparerLibrary.Replace Separate Lf ${input_file_with_separate_lf} ${output_file_lf_replaced_by_character_or_string} ${replacement_string}
DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt abc
DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt x
DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt ${SPACE}
Raw data
{
"_id": null,
"home_page": null,
"name": "DataComparerLibrary",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "robotframework testing test-automation datacompare",
"author": "Ren\u00e9 Philip Zuijderduijn",
"author_email": "datacomparerlibrary@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/f7/7a/b58cd03afad28b75628207fb7bf676204747276fcf32ccf33a2811c7ecbd/datacomparerlibrary-0.844.tar.gz",
"platform": null,
"description": "===================\r\nDataComparerLibrary\r\n===================\r\n\r\n.. contents::\r\n :local:\r\n\r\n\r\nPreparation\r\n===================\r\n\r\nInstallation\r\n------------\r\n\r\nIf you already have Python with `pip <https://pip.pypa.io>`_ installed,\r\nyou can simply run::\r\n\r\n pip install DataComparerLibrary\r\n pip install --upgrade DataComparerLibrary\r\n\r\n\r\nAlso the following pip package is needed::\r\n\r\n pip install python-dateutil\r\n\r\n\r\nImport statement for the DataComparerLibrary in Python\r\n------------------------------------------------------\r\n\r\nfrom DataComparerLibrary.datacomparer import DataComparer\r\n\r\n\r\n\r\nDataComparer\r\n============\r\n\r\nIntroduction\r\n------------\r\n\r\nThe DataComparerLibrary can be used for:\r\n - comparing csv-files or text-files\r\n - comparing a 2d-matrix with a csv-file or text-file\r\n - comparing a csv-file or text-file with a 2d-matrix\r\n - comparing 2d-matrices\r\n\r\n| In case a difference between actual and expected data is found an exception wil be given. In Robot Framework\r\n the result will be set to failed.\r\n| A strait comparison can be made, but the DataComparerLibrary offers also some special comparison options described\r\n beneath.\r\n|\r\n| {PRESENT}:\r\n| With {PRESENT} in the expected data file you can make clear that data of a field/cell of the actual data should be present.\r\n This can be helpful for fields that have constant changing values. For example generated id's.\r\n|\r\n| {EMPTY}:\r\n| With {EMPTY} in the expected data file you can make clear that data of a field/cell of the actual data should be absent.\r\n|\r\n| {SKIP}:\r\n| With {SKIP} in the expected data file you can make clear that the comparison of data of a field/cell or part of a field/cell\r\n of the actual data should be skipped. This can be helpful for fields or parts of fields that have constant changing\r\n values. For example time or generated id's.\r\n|\r\n| {INTEGER}:\r\n| With {INTEGER} in the expected data file you can make clear that the data of a field/cell of the actual data should be an\r\n integer. This can be helpful for fields that have constant changing integer values. For example integer id's.\r\n|\r\n| {NOW()...:....}:\r\n| With {NOW()} in the expected data file you can make clear that the data of a field/cell or part of a field/cell of the actual\r\n data should be (a part of) a date. You can let calculate the current or a date in the past or future. Calculation is\r\n based on the \"relativedelta\" method from Python. Also you can style the date in the format you want. This can be\r\n helpful for fields that have constant changing date values, but which date values have a fixed offset linked to the\r\n current date. At \"Examples comparing Actual Data with Expected Data\" you can find some examples how to use it.\r\n|\r\n| {DATETIME_FORMAT():YYYYMMDDHHMMSSFF6}:\r\n| With {DATETIME_FORMAT():YYYYMMDDHHMMSSFF6} in the expected data file you can make clear that the data of a field/cell or part of a field/cell of the actual\r\n data should be (a part of) a date. At this moment it is processed as {SKIP}. In the future it will be changed into a check on date format, but\r\n not a specific date. For check on a specific expected date you can use {NOW()...:....}.\r\n|\r\n|\r\n| Delimiter:\r\n| Default delimiter is \",\" in case of an input file. You can use the option \"delimiter_actual_data\" and \"delimiter_expected_data\" to set another\r\n delimiter like \";\" or \"\\t\" for tab. It is also possible to use a multi-character delimiter like \"@#@\".\r\n|\r\n| Quotechar:\r\n| Default quotechar is '\"' in case of an input file. You can use the option \"quotechar_actual_data\" and/or \"quotechar_expected_data\" to set another\r\n quotechar.\r\n\r\n\r\nComparing Data\r\n--------------\r\n\r\n\r\nExamples of using the DataComparerLibrary for comparing data in Python\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nBelow there are some examples how to call the methods of the DataComparerLibrary in Python::\r\n\r\n\r\n a = DataComparer\r\n a.compare_data_files(self, actual_file, expected_file)\r\n a.compare_data_files(self, actual_file, expected_file, delimiter_actual_data=';', delimiter_expected_data=';')\r\n a.compare_data_files(self, actual_file, expected_file, delimiter_actual_data='@#@', delimiter_expected_data='@#@')\r\n a.compare_data_2d_array_with_file(self, actual_2d_matrix_data_input, expected_file, delimiter_expected_data='\\t')\r\n a.compare_data_file_with_2d_array(self, actual_file, expected_2d_matrix_data_input, delimiter_actual_data=';')\r\n a.compare_data_2d_arrays(self, actual_2d_matrix_data_input, expected_2d_matrix_data_input)\r\n\r\n\r\nExamples of using the DataComparerLibrary keywords for comparing data in Robot Framework\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nBelow there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::\r\n\r\n\r\n *** Settings ***\r\n Library DataComparerLibrary\r\n\r\n *** Test Cases ***\r\n Testcase_DataComparer\r\n Examples\r\n\r\n *** Keywords ***\r\n Examples\r\n Run Keyword And Continue On Failure DataComparerLibrary.Compare Data Files C:\\\\Users\\\\actual.csv C:\\\\Users\\\\expected.csv\r\n DataComparerLibrary.Compare Data Files C:\\\\Users\\\\actual.csv C:\\\\Users\\\\expected.csv delimiter_actual_data=; delimiter_expected_data=;\r\n DataComparerLibrary.Compare Data Files C:\\\\Users\\\\actual.csv C:\\\\Users\\\\expected.csv delimiter_actual_data=@#@ delimiter_expected_data=@#@\r\n DataComparerLibrary.Compare Data Files C:\\\\Users\\\\actual.csv C:\\\\Users\\\\expected.csv\r\n DataComparerLibrary.Compare Data 2d Array With File ${actual_2d_matrix_data_input} C:\\\\Users\\\\expected.csv delimiter_expected_data=\\t\r\n DataComparerLibrary.Compare Data File With 2d Array C:\\\\Users\\\\actual.csv ${expected_2d_matrix_data_input} delimiter_actual_data=;\r\n DataComparerLibrary.Compare Data 2d Arrays ${actual_2d_matrix_data_input} ${expected_2d_matrix_data_input}\r\n\r\n\r\nExamples comparing Actual Data with Expected Data\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nBelow there is an example of actual and expected data with some different cases.\r\n\r\n\r\n\r\nBased on current datetime = 2023-09-06 19:04:00 (example):\r\n\r\n\r\n+--------------------------------------------------------------------------------------------------+\r\n| Actual csv file or 2d-array |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| id | name | city | start datetime | code | password |\r\n+==============+==========+==============+=================================+=========+=============+\r\n| 87 | John | London | 2019-09-01 10:00:15 | abc1 | xxxxxxxx |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| 88 | Bert | Amsterdam | 2023/09/06 19:02:00 | | xxxxxxxx |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| 89 | Klaas | Brussel | 23-8-6 12:04:17 | 5ghi | xxxxxxxx |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| 90 | Joe | Helsinki | 08062025 12:04:17 | 99fg | xxxxxxxx |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n\r\n\r\n+--------------------------------------------------------------------------------------------------+\r\n| Expected csv file or 2d-array |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| id | name | city | start datetime | code | password |\r\n+==============+==========+==============+=================================+=========+=============+\r\n| {INTEGER} | John | London | {NOW()-4Y5D:YYYY-MM-DD} | abc1 | {PRESENT} |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| {INTEGER} | Bert | Amsterdam | {NOW():YYYY/MM/DD} {SKIP} | {EMPTY} | {PRESENT} |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| {INTEGER} | Klaas | Brussel | {NOW()-1M:YY-M-D} {SKIP} | 5ghi | {PRESENT} |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n| {INTEGER} | Joe | Helsinki | {NOW()+1Y9M2D:DDMMYYYY} {SKIP} | {SKIP} | {PRESENT} |\r\n+--------------+----------+--------------+---------------------------------+---------+-------------+\r\n\r\n\r\nComparing Text\r\n--------------\r\n\r\nExamples of using the DataComparerLibrary for comparing text in Python\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nBelow there are some examples how to call the methods of the DataComparerLibrary in Python::\r\n\r\n\r\n a = DataComparer\r\n a.compare_text_files(self, actual_file, expected_file)\r\n a.compare_text_variable_with_text_file(self, actual_text_input, expected_file)\r\n a.compare_text_file_with_text_variable(self, actual_file, expected_text_input)\r\n a.compare_text_variables(self, actual_text_input, expected_text_input)\r\n\r\n\r\nExamples of using the DataComparerLibrary keywords for comparing text in Robot Framework\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nBelow there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::\r\n\r\n\r\n *** Settings ***\r\n Library DataComparerLibrary\r\n\r\n *** Test Cases ***\r\n Testcase_DataComparer\r\n Examples\r\n\r\n *** Keywords ***\r\n Examples\r\n Run Keyword And Continue On Failure DataComparerLibrary.Compare Text Files C:\\\\Users\\\\actual.txt C:\\\\Users\\\\expected.txt\r\n DataComparerLibrary.Compare Text Files C:\\\\Users\\\\actual.txt C:\\\\Users\\\\expected.txt\r\n DataComparerLibrary.Compare Text Files C:\\\\Users\\\\actual.txt C:\\\\Users\\\\expected.txt\r\n DataComparerLibrary.Compare Text Files C:\\\\Users\\\\actual.txt C:\\\\Users\\\\expected.txt\r\n DataComparerLibrary.Compare Text Variable With File ${actual_text_input} C:\\\\Users\\\\expected.txt\r\n DataComparerLibrary.Compare Text File With Text Variable C:\\\\Users\\\\actual.txt ${expected_text_input}\r\n DataComparerLibrary.Compare Text Variables ${actual_text_input} ${expected_text_input}\r\n\r\n\r\n\r\nDataSorter\r\n==========\r\n\r\nIntroduction\r\n------------\r\nThe DataSorter can be used for sorting records in a csv file or text file.\r\n\r\n\r\nDefault sorting\r\n---------------\r\nThe default sorting is alphabetically based in ascending order on column 0 on all records.\r\n\r\n\r\nSpecial sorting\r\n---------------\r\n\r\n| With the DataSorter it is possible to tune the sorting of records.\r\n|\r\n| number_of_header_lines:\r\n| Optional argument \"number_of_header_lines\" can be used to set the number of header records. These records will be excluded from sorting.\r\n In case this optional argument is not present the default value is set to 0.\r\n|\r\n| number_of_trailer_lines:\r\n| Optional argument \"number_of_trailer_lines\" can be used to set the number of trailer records. These records will be excluded from sorting.\r\n In case this optional argument is not present the default value is set to 0.\r\n|\r\n| sort_on_columns_list:\r\n| Optional argument \"sort_on_columns_list\" can be used to specify one or more columns on which should be sorted and in which order of columns.\r\n Sorting of a column can be done in an alphabetic or numeric way.\r\n|\r\n| delimiter:\r\n| Optional argument \"delimiter\" can be used to set the delimiter.\r\n Default delimiter is \",\" in case of an input file. You can use the option \"delimiter\" to set another delimiter\r\n like \";\" or \"\\t\" for tab. It is also possible to use a multi-character delimiter like \"@#@\".\r\n\r\n\r\nExamples of using the DataComparerLibrary keywords for sorting data in Robot Framework\r\n----------------------------------------------------------------------------------------\r\n\r\nBelow there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::\r\n\r\n\r\n *** Settings ***\r\n Library DataComparerLibrary\r\n\r\n *** Test Cases ***\r\n Testcase_DataSorter\r\n Examples\r\n\r\n *** Keywords ***\r\n Examples\r\n # sorting examples\r\n #\r\n # Sorting alphabetic on column 0, 5 and 4\r\n ${sorting_column_0_5_4} = create list 0 5 4\r\n # Sorting alphabetic on column 4 and 1 and numeric on colum 3\r\n ${sorting_column_4_3i_1} = create list 4 ${3} 1\r\n\r\n\r\n Run Keyword And Continue On Failure DataComparerLibrary.Sort Csv Files C:\\\\Users\\\\unsorted.csv C:\\\\Users\\\\sorted.csv\r\n DataComparerLibrary.Sort Csv Files C:\\\\Users\\\\unsorted.csv C:\\\\Users\\\\sorted.csv number_of_header_lines=5 sort_on_columns_list=${sorting_column_0_5_4} number_of_trailer_lines=5 delimiter=;\r\n DataComparerLibrary.Sort Csv Files C:\\\\Users\\\\unsorted.csv C:\\\\Users\\\\sorted.csv number_of_header_lines=4 sort_on_columns_list=${sorting_column_4_3i_1} delimiter=@#@\r\n DataComparerLibrary.Sort Csv Files C:\\\\Users\\\\unsorted.csv C:\\\\Users\\\\sorted.csv number_of_trailer_lines=2 delimiter=\\t\r\n DataComparerLibrary.Sort Csv Files C:\\\\Users\\\\unsorted.csv C:\\\\Users\\\\sorted.csv\r\n\r\n\r\nFileConverter\r\n=============\r\n\r\nIntroduction\r\n------------\r\n\r\nRecords in files can be ended by carriage return line feed (CRLF). In some situations separate line feeds (LF) are\r\npresent within records. For example for an easy way of sorting records this can be a problem.\r\n\r\nDataComparerLibrary keywords for preparing data in Robot Framework\r\n------------------------------------------------------------------\r\n\r\nThe keywords \"Remove Separate Lf\" and \"Replace Separate Lf\" support removing/replacing a separate Lf in the data from\r\nthe input file. The result will be written to an output file.\r\n\r\n\r\nExamples of using the DataComparerLibrary keywords for preparing data in Robot Framework\r\n----------------------------------------------------------------------------------------\r\n\r\nBelow there are some examples how to call the keywords of the DataComparerLibrary in Robot Framework::\r\n\r\n\r\n *** Settings ***\r\n Library DataComparerLibrary\r\n\r\n *** Test Cases ***\r\n Testcase_FileConverter\r\n Remove Separate LF From Data In File\r\n Replace Separated LF With Character Or String From Data In File\r\n\r\n *** Keywords ***\r\n Remove Separate LF From Data In File\r\n DataComparerLibrary.Remove Separate Lf ${path_actual_input_files}\\\\input_file_with_lf.txt ${path_actual_output_files}\\\\output_file_without_lf.txt\r\n\r\n\r\n Replace Separated LF With Character Or String From Data In File\r\n DataComparerLibrary.Replace Separate Lf ${input_file_with_separate_lf} ${output_file_lf_replaced_by_character_or_string} ${replacement_string}\r\n DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt abc\r\n DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt x\r\n DataComparerLibrary.Replace Separate Lf input_file_with_separate_lf.txt output_file_lf_replaced_by_character_or_string.txt ${SPACE}\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "Apache",
"summary": "For comparing csv-files, 2d-array with a csv-file or 2d-arrays. For comparing text-files, text variable with a text-file or text variables. Including a sorting module.",
"version": "0.844",
"project_urls": null,
"split_keywords": [
"robotframework",
"testing",
"test-automation",
"datacompare"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "90c3c3007f3dddfd443db7570a518dd77b865e07289fd1a4a97f3f28a40b3259",
"md5": "de6723d79c7a8b7ccdba8841b57b6b6c",
"sha256": "b9cc9a3cb4f6becd2c800c3dc60afc3447ccc1354e9bca698450b3426e01a9e8"
},
"downloads": -1,
"filename": "DataComparerLibrary-0.844-py3-none-any.whl",
"has_sig": false,
"md5_digest": "de6723d79c7a8b7ccdba8841b57b6b6c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 17623,
"upload_time": "2025-01-02T20:50:27",
"upload_time_iso_8601": "2025-01-02T20:50:27.500006Z",
"url": "https://files.pythonhosted.org/packages/90/c3/c3007f3dddfd443db7570a518dd77b865e07289fd1a4a97f3f28a40b3259/DataComparerLibrary-0.844-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f77ab58cd03afad28b75628207fb7bf676204747276fcf32ccf33a2811c7ecbd",
"md5": "adc509d3e3e74db39978b59ad711ae53",
"sha256": "ed980227cc1ba7c6c677f98b784fc6e9754771621323df5d684fed3b88b71725"
},
"downloads": -1,
"filename": "datacomparerlibrary-0.844.tar.gz",
"has_sig": false,
"md5_digest": "adc509d3e3e74db39978b59ad711ae53",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19348,
"upload_time": "2025-01-02T20:50:29",
"upload_time_iso_8601": "2025-01-02T20:50:29.477025Z",
"url": "https://files.pythonhosted.org/packages/f7/7a/b58cd03afad28b75628207fb7bf676204747276fcf32ccf33a2811c7ecbd/datacomparerlibrary-0.844.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-02 20:50:29",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "datacomparerlibrary"
}