【问题标题】:Robotframework- Exclude a test case from run is not working for meRobotframework-从运行中排除测试用例对我不起作用
【发布时间】:2016-10-24 20:28:57
【问题描述】:

以下是我代码底部的 2 个测试用例。

Click correct answer 1
    Selenium2Library.Capture Page Screenshot
    Selenium2Library.Select Frame   xpath=//iframe[@title="QUIZ : QA VSTEST"]
    Selenium2Library.click element  xpath = //div[contains(@class,"ItemHeader") and descendant::div[text()="${Question1} "]]/..//div[@data-value="${Quiz1x}"]


Click correct answer 2
    [Documentation]     Capture Page Screenshot is recorded here as I use more than 1 libraries. Normally I do not need this command here.
    [Tags]  BugMute
    Selenium2Library.Unselect Frame
    Selenium2Library.Capture Page Screenshot
    Selenium2Library.Select Frame   xpath=//iframe[@title="QUIZ : QA VS TEST"]
    Selenium2Library.click element  xpath = //div[contains(@class, "ItemHeader") and descendant::div[text()="What describes best Testing "]]/..//div[@data-value="${Quiz2x}"]

我使用命令行运行代码

pybot --exclude BugMute  itqa.robot

itqa.robot 是我的文件名。我不明白为什么测试用例“单击正确答案 2”在日志中显示为运行。 我有带有标签 BugMute 的排除命令。此标记在测试用例中。

我的日志文件显示测试用例运行(失败但没关系)

KEYWORD 点击正确答案2

文档: Capture Page Screenshot 记录在这里,因为我使用了超过 1 个库。通常我在这里不需要这个命令。 标签: 静音 开始/结束/经过: 20161023 15:15:45.277 / 20161023 15:15:46.192 / 00:00:00.915 00:00:00.015 关键字 Selenium2Library 。取消选择框架

文档: 将顶部帧设置为当前帧。 开始/结束/经过: 20161023 15:15:45.277 / 20161023 15:15:45.292 / 00:00:00.015 00:00:00.217 关键字 Selenium2Library 。捕获页面截图 等等

解释器不应该跳过整个测试用例点击正确答案2吗?

【问题讨论】:

  • 我测试了您的代码,成功排除了 Tag BugMute 测试。我想知道为什么你看到你的Click correct answer 2 被称为关键字。
  • 非常感谢。我的错,我的标题错误。
  • 如果你偶然知道我可以如何使用 exclude 命令设置我的 pycharm 编辑器,那也很棒。我现在在命令行上运行。
  • 抱歉,但是当我使用 PyCharm 时,我只是去它的控制台并发送robot --exclude WhatEverTag path_to_my_test_suite.robot
  • 那么问题现在回答了吗?

标签: robotframework


【解决方案1】:

请注意,日志中显示“KEYWORD 单击正确答案 2”。您在测试文件的*** Keywords*** 部分而不是*** Test Cases *** 部分中有这段代码。

【讨论】:

    猜你喜欢
    • 2019-09-14
    • 2019-11-07
    • 2021-08-06
    • 1970-01-01
    • 2016-08-28
    • 2012-08-13
    • 2014-02-12
    • 2019-02-17
    相关资源
    最近更新 更多