I am implementing a test automation framework with using robot framework. But i couldn't manage some JSON things.. I have a robot file full of keywords (no tests), i tried to read the json file (with full of xpaths) in test setup section, but it failed.
Is it possible to read the file at the beginning of a robot file and use that object for every keyword in that list?
Current structure:
keyword 1
read json
do sth
keyword 2
read json
do sth
keyword 3
read json
do sth
What i want?
read json
keyword 1
do sth
keyword 2
do sth
keyword 3
do sth
Current İmplemantation:
*** Settings ***
Library SeleniumLibrary
Library JSONLibrary
Library OperatingSystem
Resource ../PageObjects/LoginPage.robot
Suite Setup Read object repository locators
*** Keywords ***
Read object repository locators
[Documentation] For all elements on website, this keyword is returns an
xpath collection for other keywords
# read the json data
${json}= Get file ../library/ObjectRepository.json
# convert the data to a object
${object}= Evaluate json.loads(r'''${json}''')
set suite variable ${object}
Read object
${password}= Set Variable ${object["registerInfo"][0]["password"]}