有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java TestNG断言似乎无法处理Cucumber/Gherkin文档字符串?

Iam目前试图使用Cucumber文档字符串,更多信息如下:https://docs.cucumber.io/gherkin/reference/#gherkin-dialects但是我的代码似乎无法使用TestNG断言将功能文件字符串与包含在我的step文件中的字符串进行比较,有什么想法吗

我的功能文件:

  Scenario: Test
    Given then i should receive an email with the body off:
    """
    then i should receive an email with the body off
    then i should receive an email with the body off.
    """

我的步骤方法:

@Given("^then i should receive an email with the body off:")
public void how_are_your(String arg1) {
    Assert.assertEquals(arg1, "then i should receive an email with the body off" + "\nthen i should receive an email with the body off.");
}

断言似乎失败,提供了以下异常:

java.lang.AssertionError: expected [then i should receive an email with the body off
then i should receive an email with the body off.] but found [then i should receive an email with the body off
then i should receive an email with the body off.]

并列例外:

expected [then i should receive an email with the body off
then i should receive an email with the body off.] 

found [then i should receive an email with the body off
then i should receive an email with the body off.]

共 (0) 个答案