【发布时间】:2019-01-23 22:13:38
【问题描述】:
我正在努力使用-s --suite 选项。
当我运行我所有的测试用例文件时,像这样:robot .,一切都很好(即告诉机器人运行当前文件夹中的所有测试用例文件,. 用于当前文件夹)。或者,如果我想运行特定的测试用例文件,比如说robot mytest.robot,也可以正常工作。
但是,最近我创建了一个 init 文件。运行robot . 时正在执行那个(因为它存储在该目录中),但运行robot mytest.robot 时自然不会执行。到目前为止,一切都清楚了。
我认为简单的解决方案是运行robot -s mytest.robot .
但是,我收到一个错误:Suite 'BDD' contains no tests in suite 'mytest.robot'.
这是不对的,因为正如我上面提到的,像robot mytest.robot 从同一个目录运行它工作正常,该文件中的测试用例被处理。
此外,即使我运行robot -s non_existent_test_case_file.robot . >>> Suite 'BDD' contains no tests in suite 'non_existent_test_case_file.robot'.,我也得到了相同的结果,这也应该证明问题不在于我的 mytest.robot 没有指定测试=错误消息完全错误.
使用:Robot Framework 3.1 (Python 3.6.6 on linux)
有什么提示吗?
添加更多信息
我创建了新文件夹“temp”,我将__init__.robot 和mytest.robot 文件移到了其中。我编辑了它们,使它们尽可能基本。
__init__.robot:
*** Settings ***
Suite Setup RobotSetup
Suite Teardown RobotTeardown
*** Keywords ***
RobotSetup
Log To Console robot init setup
RobotTeardown
Log To Console robot init teardown
mytest.robot:
*** Test Cases ***
MyBestTestCase
Log To Console hello world
结果:
[/vagrant/test/bdd/temp]$ ll
total 8
-rwxrwxrwx. 1 vagrant vagrant 213 Jan 23 10:44 __init__.robot
-rwxrwxrwx. 1 vagrant vagrant 74 Jan 23 10:44 mytest.robot
[/vagrant/test/bdd/temp]$ robot .
==============================================================================
Temp
==============================================================================
robot init setup
Temp.Mytest
==============================================================================
MyBestTestCase hello world
MyBestTestCase | PASS |
------------------------------------------------------------------------------
Temp.Mytest | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
robot init teardown
Temp | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
...和
[/vagrant/test/bdd/temp]$ robot -s mytest.robot .
[ ERROR ] Suite 'Temp' contains no tests in suite 'mytest.robot'.
【问题讨论】:
标签: robotframework