如何在JAVA中将测试故事标记为PENDING

时间:2018-04-18 21:05:27

标签: java selenium cucumber scenarios

我在JAVA硒黄瓜环境中进行UI测试 如何故意制作测试PENDING的状态?现在我失败了并且通过了。 我暂时需要这个功能,我知道测试只能通过或失败,而且选择其他选项不是一个好选择。 (我不想在詹金斯做任何配置。)

谢谢

1 个答案:

答案 0 :(得分:1)

您可以从匹配的stepdefinition方法中抛出Alter Procedure usp_Procedure_No ( @value VARCHAR(255), @constraint VARCHAR(255) = NULL ) AS BEGIN EXEC sp_executesql @value, @constraint, N' If @constraint = ''Gender'' BEGIN alter View DupView as Select * from Personalities where Gender != @value END If @constraint = ''Place'' BEGIN alter View DupView as Select * from Personalities where Place != @value END If @constraint = ''MaritalStatus'' BEGIN alter View DupView as Select * from Personalities where MaritalStatus != @value END If @constraint = ''Age'' BEGIN alter View DupView as Select * from Personalities where PersonalityAge != @value END If @constraint = ''Nationality'' BEGIN alter View DupView as Select * from Personalities where Nationality != @value END If @constraint = NULL BEGIN alter View DupView as Select * from Personalities where Characterstics1 != @value OR Characterstics2!= @value OR Characterstics3 != @value END ' END 。这会将场景显示为待处理。为了获得这些待定的步骤定义,可以在跑步者的黄瓜选项中轻松使用cucumber.api.PendingException

对于以下功能文件。

dryRun=true

示例步骤定义

  Scenario: Run Pending scenario
    Given step one
    When step two
    Then step three

  Scenario: Run Defined scenario
    Given step one defined
    When step two defined
    Then step three defined

结果将显示如下。 '步骤'部分将仅显示第一步作为待处理,剩余部分作为跳过。虽然这个场景' section给出了待处理场景的整体状态。

@Given("^step one$")
    public void stepOne() {
        // Write code here that turns the phrase above into concrete actions
        throw new PendingException();
    }