com.github.jep42:robotframework-formatcompare-remoteserver

Robot framework keywords to compare different data structures (csv, xml, json) via mapfiles

License

License

Categories

Categories

ORM Data
GroupId

GroupId

com.github.jep42
ArtifactId

ArtifactId

robotframework-formatcompare-remoteserver
Last Version

Last Version

0.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

Robot framework keywords to compare different data structures (csv, xml, json) via mapfiles

Download robotframework-formatcompare-remoteserver

How to add to project

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

Dependencies

compile (4)

Group / Artifact Type Version
com.github.jep42 : robotframework-formatcompare jar 0.0.3
org.robotframework : javalib-core jar 1.2.1
com.github.ombre42 : jrobotremoteserver jar 3.0
org.slf4j : slf4j-api jar 1.7.21

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 Maven Central

robotframework-formatcompare

Description

This library provides keywords to compare different data structures (csv, xml, json, xls(x)) via mapfiles. The mapfile specifies the elements which are compared with each other and defines certain rules for this compare operation.

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)

Jython

*** Settings ***
Library    com.github.jep42.robotformatcompare.RobotFormatCompare

Remote Library Server

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

Robot Testcase Sample: Compare JSON with XML

*** Test Cases ***
Compare Download Formats JSON And XML
    ...
    Initialize Json Format Handler    GMT+01:00    dd.MM.yyyy HH:mm:ss    dd.MM.yyyy    " ,2"
    Initialize Xml Format Handler    GMT+01:00     yyyyMMddHHmmss    yyyyMMddHHmmss    " .2"
    Compare Json With XML    ${TESTDATA}/json2xml.mapfile    ${TEMPDIR}/jsondownload.json    ${TEMPDIR}/xmldownload.xml
    ...

The test case above references the mapfile ${TESTDATA}/json2xml.mapfile which maps elements from a Json (JSONPath expression) to elements of an XML (XPath expression) structure:

$.data[0].firstname;Neverland/Persons/Person[1]/Firstname;STRING;=;;
$.data[0].lastname;Neverland/Persons/Person[1]/Lastname;STRING;=;;
$.data[0].email;Neverland/Persons/Person[1]/Email;STRING;=;;
$.data[0].email;Neverland/Persons/Person[1]/Email2;STRING;!=;;
$.data[0].sex;Neverland/Persons/Person[1]/Firstname;STRING;=;;

Robot Testcase Sample: Compare CSV with XML

Compare Download Formats CSV And XML
    ...
    Initialize Csv Format Handler    GMT+01:00    dd.MM.yyyy HH:mm:ss    dd.MM.yyyy    " ,2"    0
    Initialize Xml Format Handler    GMT+01:00     yyyyMMddHHmmss    yyyyMMddHHmmss    " .2"
    Compare Csv With XML    ${TESTDATA}/csv2xml.mapfile    ${TEMPDIR}/csvdownload.csv    ${TEMPDIR}/xmldownload.xml
    ...

The test case above references the mapfile ${TESTDATA}/csv2xml.mapfile which maps elements from a CSV (EasyCSVMap selector expression) to elements of an XML (XPath expression) structure:

{1}.firstname;Neverland/Persons/Person[1]/Firstname;STRING;=;;
{1}.lastname;Neverland/Persons/Person[1]/Lastname;STRING;=;;
{1}.email;Neverland/Persons/Person[1]/Email;STRING;=;;
{1}.email;Neverland/Persons/Person[1]/Email2;STRING;!=;;
{1}.sex;Neverland/Persons/Person[1]/Sex;STRING;=;;

Dependencies

  • org.robotframework:javalib-core:1.2.1 (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)
  • com.github.jep42:robotframework-easycsvmap:0.0.2 (Download from Maven Central)
  • com.jayway.jsonpath:json-path:2.2.0 (Download from Maven Central)
  • org.apache.poi:poi:3.17 (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 "formatcompare": The keyword library
  • Sub-module "remoteserver": The remote server which already contains the keyword library

Versions

Version
0.0.3
0.0.2