How to use YAML file with robot.

1,577 views
Skip to first unread message

SIDHARTH RAJ

unread,
Oct 26, 2022, 8:52:55 AM10/26/22
to robotframework-users
Hi All,
can we acess the value of array of objects(key-value pair) from YAML to our Robot testsuite?
.yaml look like :
  DeviceList:
  - Meter: xyz 3PSM
    EPLan: 67.03.03.ad
  - Meter: abc 1PSM
    EPLan: 67.03.03.ac
if yes , than how ?

Thanks !

Craig Despeaux

unread,
Oct 26, 2022, 11:22:26 AM10/26/22
to robotframework-users

Julio Lemus

unread,
Oct 26, 2022, 12:28:41 PM10/26/22
to sidharth...@gmail.com, robotframework-users
in your testsuite only access to variable:

*** Settings ***
Variables     <path of your yaml>     #it's optional, if you want to change with each execution then when you run robot command, send in next parameter: --variableFile <path>  the path of your yaml file.

*** Test Cases ***
Test 1
    Log    message=Variable: ${DeviceList.Meter}


Your yaml file:

  DeviceList:
  - Meter: xyz 3PSM
  - EPLan: 67.03.03.ad

In other yaml file:
  DeviceList:
  - Meter: abc 1PSM
  - EPLan: 67.03.03.ac


Saludos cordiales

Julio Isaías Lemus López
Ingeniero en Ciencias y Sistemas
Teléfono: (502) 5602 5000

Antes de imprimir este correo electrónico, piense bien si es necesario hacerlo: El medio ambiente es cuestión de todos.


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/68448a9d-f0fd-4e10-9e15-b6b48f4ebdadn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages