我正在为这个-s --suite选择而挣扎。当我运行我的所有测试用例文件时,如下所示:robot .,一切都很好(即告诉机器人运行当前文件夹中的所有测试用例文件.)。或者,如果我想运行特定的测试用例文件,比如说robot mytest.robot,也可以正常工作。
然而,最近我创建了一个初始化文件。那个是在运行时执行的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
Run Code Online (Sandbox Code Playgroud)
mytest.robot:
*** Test Cases ***
MyBestTestCase
Log To Console hello world
Run Code Online (Sandbox Code Playgroud)
结果:
[/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
Run Code Online (Sandbox Code Playgroud)
... 和
[/vagrant/test/bdd/temp]$ robot -s mytest.robot .
[ ERROR ] Suite 'Temp' contains no tests in suite 'mytest.robot'.
Run Code Online (Sandbox Code Playgroud)
问题是您告诉机器人运行“mytest”套件中的“robot”套件,但它找不到名为“robot”的套件。既然它找不到名为“robot”的套件,那么它当然也找不到名为“robot”的套件中的任何测试。
当您使用 时--suite,您不给它文件名,您必须给它测试套件名称。在你的情况下,你会运行机器人robot -s mytest .。
| 归档时间: |
|
| 查看次数: |
15941 次 |
| 最近记录: |