Looping through the content of a file in RobotFramework -


how can loop through contents of file within robot framework?

my file contents this:

1001
1002
1003
1004

i want read contents 1 one, assign variable , operations it.

robotframework has several built-in libraries add lot of functionality. 2 can use task operatingsystem library , string library.

you can use keyword get file operatingsystem library read file, , can use split lines keyword string library convert file contents list of lines. it's matter of looping on lines using for loop.

for example:

*** settings *** | library | operatingsystem | library | string  *** test cases *** | example of looping on lines in file | | ${contents}= | file | data.txt | | @{lines}= | split lines | ${contents} | | :for | ${line} | in | @{lines} | | | log | ${line} | warn 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -