简体   繁体   English

Robot Framework Test Suite目录如何精确工作?

[英]How are Robot Framework Test Suite Directories working precisely?

I am working on a Python library and test suite for testing particular pieces of hardware by using Robot Framework. 我正在研究Python库和测试套件,以通过使用Robot Framework测试特定的硬件。 At that point, I have enough test cases to think about splitting them into several files or even test suites, so I went to the User Guide and found Test Suite Directories section . 那时,我有足够的测试用例,可以考虑将它们分成几个文件甚至测试套件,因此我去了《用户指南》,找到了“ 测试套件目录”部分

Following the description, I have created following directory structure: 按照说明,我创建了以下目录结构:

MyPythonLib\
    MyPythonLib.py
    ...
MyTestSuite\
    __init__.robot
    01_FirstSetOfTests.robot
    02_SecondSetOfTests.robot
Common.robot

The __init__.robot file contains my settings: __init__.robot文件包含我的设置:

*** Settings ***
Library     Dialogs
Library     Collections
Resource    ../Common.robot
Library     ../MyPythonLib/MyPythonLib.py

*** Keywords ***

Some Keywords Specified Here

Then I run the test suite by specifying directory instead of a file, like this: 然后,我通过指定目录而不是文件来运行测试套件,如下所示:

robot MyTestSuite

When doing so, it does not recognize keywords specified in __init__.robot file, as well as others. 这样做时,它无法识别__init__.robot文件中指定的关键字以及其他关键字。 Since all of the settings are taken away from test case files, as I expected them to be included with the __init__ file, this makes me question if the directories are parsed as I understand they should. 由于所有设置都从测试用例文件中删除,正如我希望它们包含在__init__文件中一样,这使我怀疑是否按我理解的方式对目录进行了解析。 What am I doing wrong and how can I solve that issue? 我做错了什么,该如何解决呢?

The behavior you describe is documented behavior. 您描述的行为是记录的行为。

From the robot framework user guide (emphasis added): 机器人框架用户指南 (添加了重点):

Variables and keywords created or imported in initialization files are not available in the lower level test suites . 在较低级别的测试套件中没有在初始化文件中创建或导入的变量和关键字 If you need to share variables or keywords, you can put them into resource files that can be imported both by initialization and test case files. 如果需要共享变量或关键字,可以将它们放入资源文件中,该文件可以通过初始化文件和测试用例文件导入。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Robot Framework:如何在不同路径中维护(子)测试套件目录 - Robot Framework : How to maintain (sub) test suite directories in different paths 如何并行运行机器人框架测试用例而不是并行运行测试套件? - How to run robot framework test cases parallel and not Test Suite parallel? 机械手框架-测试套件以json格式输出 - Robot framework - Test suite output in json format 如何使用 Robot Framework 从测试套件运行特定的测试用例 - How to run specific test cases from a test suite using Robot Framework 如何在机器人框架中并行运行多个测试套件上的多个测试用例 | Python - How to run multiple test case on multiple test suite parallely in robot framework | Python 在运行的测试套件上动态创建机器人框架测试用例 - create robot framework Test Case dynamically on running test suite 机器人框架 - 如何从报告中读取套件名称、测试用例名称以及跳过消息。html - Robot framework - How to read suite name, test case name along with skip message from report.html Robot Framework从测试套件元数据访问关键字 - Robot Framework accessing a keyword from test suite Metadata 使用 python 对 Robot Framework 中的测试套件中的每个测试用例进行测试设置和拆卸 - Test Setup and Teardown for each test case in a test suite in Robot Framework using python 如何在机器人框架的套件设置中“运行关键字 if tag="debug"” - How to "run a keyword if tag="debug"" in suite setup in robot framework
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM