Skip to content

qualersoft/robotframework-kolib

Repository files navigation

robotframework-kolib

A library to easily create Robot Framework libraries based on kotlin.

Credits

This project is inspired by the javalib-core

Intro

In contrast to the all-in-one solution provided by javalib-core, this project is divided into a core library, and an example library utilizing spring.

The core provide ready to use utils to easily create your own general library implementation without the need to take care of Robot Framework or kotlin specifics.

Pitfalls

The following chapter give you an overview of some pitfalls you may run into when working with Robot Framework and an own library.

Varargs and lists

Robot Framework will not automatically convert vararg arguments to a list. Instead, each argument is passed as is, so the core lib has to take care of this to give you a "natural" usage.

vararg example
*** Test Cases ***
Test with varargs
  Print the names    Hugo  Amy  Josh

As a result of this, passing a list object created with Create list build-in will result in type-conversion error

list example
*** Test Cases ***
Test with list
  @{names}=  Create list   Hugo  Amy  Josh
  Print the names    @{names}

Type conversion

Dates

Robot Framework can automatically convert strings like 2021-09-13 to a date object. The generated Date(time) object will be generated in UTC timezone which may lead to unexpected results.

Example
*** Test Cases ***
Test with date
  Print the date  2021-09-13

This will - in my case (UTC+2) - result in an output 2021-09-13 02:00:00 instead of expected 2021-09-13 00:00:00.