2015-04-01 85 views

回答

6

这里有一个建议:

*** 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

的及时答复非常感谢。如果我想添加下一个值,只需使用Append To File。我对吗? – mia 2015-04-02 12:25:29

+0

是的,在开始时只做一次“创建文件”,然后“追加到文件”(如果对您来说可以,您可以将问题设置为回答?)。 – 2015-04-02 12:32:11