我想将我所有的输出文件移动到自定义位置,移动到基于运行时日期时间创建的运行目录。在TestSetup中按日期时间创建输出文件夹
我有函数“Process_Output_files”,它将文件移动到运行文件夹(Run1、Run2、Run3 文件夹)。
我尝试使用参数-d 并使用函数“Process_Output_files”作为套件拆卸以将输出文件移动到相应的运行目录。
但是我收到以下错误“该进程无法访问该文件,因为它正被另一个进程使用”。我知道这是因为 Robot Framework (Ride) 目前正在使用它。
如果我不使用 -d 参数,输出文件将保存在临时文件夹中。
c:\users\<user>\appdata\local\temp\RIDEfmbr9x.d\output.xml
c:\users\<user>\appdata\local\temp\RIDEfmbr9x.d\log.html
c:\users\<user>\appdata\local\temp\RIDEfmbr9x.d\report.html
我的问题是,有没有办法在运行时使用 Robot Framework 将文件移动到自定义位置。
最佳答案
您可以在 RIDE (Arguments:) 中使用以下语法在新文件夹中动态创建输出
--outputdir C:/AutomationLogs/%date:~-4,4%%date:~-10,2%%date:~-7,2% --timestampoutputs
上述语法为您提供以下文件夹中的输出:
Output: C:\AutomationLogs\20151125\output-20151125-155017.xml
Log: C:\AutomationLogs\20151125\log-20151125-155017.html
Report: C:\AutomationLogs\20151125\report-20151125-155017.html
希望这可以帮助 :)
关于robotframework - 如何在运行时获取和设置 Robot Framework(Ride) 中的默认输出目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17919279/