我遇到了Robot Framework测试套件的问题.我有一个像这样的简单测试结构:
robotframework
|_foo
|_tests folder
|_pages folder
|_firefoxTestProfile folder
|_...
Run Code Online (Sandbox Code Playgroud)
我设置了一个简单的Firefox配置文件路径来运行我的测试并设置变量,如下所示:
*** Variables ***
${FF_PROFILE} foo\firefoxTestProfile
*** Keywords ***
Open browser window
Open Browser ${test_url} ${browser}
... ff_profile_dir=${FF_PROFILE}
Run Code Online (Sandbox Code Playgroud)
当我从顶层目录运行我的测试时,它运行良好:
C:/robotframework$ pybot foo/tests/test.txt
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试从foo目录运行它,如下所示:
C:/robotframework/foo$ pybot tests/test.txt
Run Code Online (Sandbox Code Playgroud)
说测试失败了
"The system cannot find the path specified: foo/firefoxTestProfile/*.*"
Run Code Online (Sandbox Code Playgroud)
我尝试了各种各样的东西,比如把路径当作
../foo/firefoxTestProfile
/foo/firefoxTestProfile
firefoxTestProfile
Run Code Online (Sandbox Code Playgroud)
以及将firefoxTestProfile文件夹移动到文件结构中的不同路径并更新到该新路径,但这些都不起作用并显示与以前相同的错误消息.
这也很重要,因为我想要一个默认的firefox配置文件与测试一起运行,这些测试在不同的人之间传递,以便在他们的机器上本地运行它们.任何帮助将不胜感激.
testing automated-tests relative-path filepath robotframework
我正在通过带有.robot文件设置的文本格式使用Robot Framework。我一直在寻找一种方法,|在变量中每边都包含空格的竖线字符,以使变量中的内容易于阅读,而又不会导致Robot Framework将其视为分隔符。问题在于,Robot Framework始终将在其每一侧至少具有一个空格的管道字符视为文本格式的分隔符。
我之所以要这样做,是因为在我的测试中,使用Selenium2Library,我链接了一些页面标题,以便在其中包含管道字符以及需要验证的空格,最好是完全匹配的文本。
我在Robot Framework中的变量如下所示:
| ${MY VARIABLE} | This site | Check it out |
Run Code Online (Sandbox Code Playgroud)
在python中,这看起来像这样:
MY_VARIABLE = "This site | Check it out"
Run Code Online (Sandbox Code Playgroud)
上面的变量应该包含管道字符,但是在Robot Framework示例中,中间管道字符充当变量中的分隔符(因为它的每一侧都像其他管道字符分隔符一样具有空格)。
有没有办法告诉Robot Framework在内容中包含这个“ |”,例如以某种方式包装变量的内容?我尝试使用方括号,括号和花括号,但似乎没有用。