How to write a variable into a file?

后端 未结 2 1947
旧时难觅i
旧时难觅i 2020-12-30 16:28

I would like to store ${Username} value in an output file:

E.g. If ${Username} equals 0401190926729000, this value will be sto

相关标签:
2条回答
  • 2020-12-30 16:50

    linux: Run echo "${Username}" > /tmp/foo

    0 讨论(0)
  • 2020-12-30 17:14

    Here is an proposal:

    *** Settings ***
    Library  OperatingSystem
    Library  String
    
    *** test cases ***
    write_variable_in_file
      ${Username} =  Generate Random String  1  abc
      log to console   ${Username}
      run keyword if  '${Username}' == 'a'   write_variable_in_file  ${Username}
    
    *** Keywords ***
    write_variable_in_file
      [Arguments]  ${variable}
      Create File  ${EXECDIR}/file_with_variable.txt  ${variable}
    
    0 讨论(0)
提交回复
热议问题