0

I am using Page Object Model in Robot Framework Test Automation and I am trying to pick up the test data using the page object file name. So I would like to read the file name in which I am currently in.

enter image description here

Is there a way to pick up the file name from login.po.resource so that I can pick up the relevant test data automatically ?

I tried ${SUITE SOURCE} but that would only give me Test Suite Name.

Also tried to define a pythod library with file; But that gives me the library name.

PS: Found a work around. But still need a proper solution.

enter image description here

  • Have you tried something like `${CURDIR}/login.po.resource`? – Bryan Oakley Nov 01 '22 at 19:45
  • That would work. But the purpose is to automatically pick up the test data with any given "xxx.po,resource" file. So I would preferrable have something similar to ${CURDIR}/${myPOFile} – Thirumaran Sujavarathan Nov 01 '22 at 21:05
  • I found a workaround to this. But if someone suggests a proper solution or an easy one, I would appreciate it. Workaround: Since I would have only one xxx.po.resource, I can get the file name using a directory listing. – Thirumaran Sujavarathan Nov 01 '22 at 21:10
  • If you know which POM you should use before launching the test, you could give the name as a command line argument like ``-v POM=login.po-en.json`` - See [documentation](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#setting-variables-in-command-line) – Morkkis Nov 02 '22 at 07:08

0 Answers0