com.github.jep42:robotframework-easycsvmap

Robot framework keywords to read/write values of CSV file

License

License

Categories

Categories

CSV Data Data Formats
GroupId

GroupId

com.github.jep42
ArtifactId

ArtifactId

robotframework-easycsvmap
Last Version

Last Version

0.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

Robot framework keywords to read/write values of CSV file

Download robotframework-easycsvmap

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.jep42/robotframework-easycsvmap/ -->
<dependency>
    <groupId>com.github.jep42</groupId>
    <artifactId>robotframework-easycsvmap</artifactId>
    <version>0.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.jep42/robotframework-easycsvmap/
implementation 'com.github.jep42:robotframework-easycsvmap:0.0.5'
// https://jarcasting.com/artifacts/com.github.jep42/robotframework-easycsvmap/
implementation ("com.github.jep42:robotframework-easycsvmap:0.0.5")
'com.github.jep42:robotframework-easycsvmap:jar:0.0.5'
<dependency org="com.github.jep42" name="robotframework-easycsvmap" rev="0.0.5">
  <artifact name="robotframework-easycsvmap" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.jep42', module='robotframework-easycsvmap', version='0.0.5')
)
libraryDependencies += "com.github.jep42" % "robotframework-easycsvmap" % "0.0.5"
[com.github.jep42/robotframework-easycsvmap "0.0.5"]

Dependencies

compile (2)

Group / Artifact Type Version
org.robotframework : javalib-core jar 1.2.1
com.github.jep42 : easycsvmap jar 0.0.5

test (2)

Group / Artifact Type Version
junit : junit jar 4.10
org.mockito : mockito-all jar 1.10.19

Project Modules

There are no modules declared in this project.

Build Status codecov Quality Gate Maven Central Docker Cloud Build Status

robotframework-easycsvmap

Description

The library provides keywords for Robot Framework to handle CSV files. It enables test case developers to select the cells of a CSV via flexible selector expressions e.g. by specifying the column name instead of column index. In most cases this is more intuitive than selecting cells via column index and it simplifies the work with CSVs especially for CSVs with a large number of columns. Moreover, the selector expressions support usage of regular expressions to select particular rows via a custom search string. The library supports sessions to be able to work with multiple CSV files in parallel.

Keywords

See the keyword documentation for information about the provided keywords.

Usage

Since the library is implemented in Java it can be used together with Jython just by importing the library within the test file. To be able to use it with Python the library has to be imported as remote library (refer to the RobotFrameworkUserGuide for more information about Remote Libraries). Be aware that the Java remote server implementation jrobotremoteserver does not support different library scopes (ROBOT_LIBRARY_SCOPE), hence the scope of the library is always GLOBAL.

Jython

*** Settings ***
Library    com.github.jep42.roboteasycsv.RobotEasyCsv

Remote Library Server

*** Settings ***
Library    Remote    http://localhost:8270/RobotEasyCsv

Robot Testcase

Assume a CSV file ${TEMPDIR}/userdata.csv with the following content:

firstname;lastname;email;sex
Peter;Pan;[email protected];male
Tinker;Bell;[email protected];female
James;Hook;[email protected];male
Reading CSV values

A common scenario is to read values from a CSV (e.g. to perform checks on it).

*** Test Cases ***
Check CSV Values
    ...
    Parse Csv From File    ${csvSessionId}    ${TEMPDIR}/userdata.csv    0
    {name}=    Get First Csv Value    ${csvSessionId}    {1}.lastname
    Should Be Equal 	${name} 	Pan
    {name}=    Get First Csv Value    ${csvSessionId}    {2}.lastname
    Should Be Equal 	${name} 	Bell
    ...
Changing CSV values

Another common scenario is to change values of a CSV (e.g. to test upload/download scenarios) or to add rows.

*** Test Cases ***
Change CSV Values
    ...
    Parse Csv From File    ${csvSessionId}    ${TEMPDIR}/userdata.csv    0
    Set Csv Values    ${csvSessionId}    {1}.email    [email protected]
    Set Csv Values    ${csvSessionId}    [email=^captain.*$].firstname    LittleJames
    Add Row    ${csvSessionId}    Wendy    Darling    [email protected]    female
    Save Csv To File    ${csvSessionId}    ${TEMPDIR}/userdata_updated.csv
    ...

Dependencies

  • org.robotframework:javalib-core:1.2.1 (Download from Maven Central)
  • net.sf.opencsv:opencsv:2.3 (Download from Maven Central)
  • com.google.code.findbugs:jsr305:2.0.1 (Download from Maven Central)
  • org.slf4j:slf4j-api:1.7.21 (Download from Maven Central)
  • [only for sub-module remoteserver] com.github.ombre42:jrobotremoteserver:3.0 (Download from Maven Central)

Build from source

  • Clone the repository
  • Execute mvn install on the root folder of the project to build the reactor which consist of two modules
  • Sub-module "easycsvmap": The keyword library
  • Sub-module "remoteserver": The remote server which already contains the keyword library

Versions

Version
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1