使用带有Java的小黄瓜。将@Given标记值复制为sting

时间:2017-12-25 08:07:15

标签: java cucumber gherkin extentreports

我有一个小黄瓜+ java测试和ExtentReports来生成报告。我发现了一些解决方案,可以用小黄格式打印我的ExtentReports。所以,我使用https://github.com/anshooarora/extentreports-java作为BDD。问题是我得到的代码如下:

 @Given("^I navigates to My Account page$")
    public void I_navigates_to_My_Account_page() throws Throwable {
        com.aventstack.extentreports.ExtentTest given = scenario.createNode(new GherkinKeyword("Given"), "I navigates to My Account page").info("info");

但我不想复制@Given值并使用它的值并使用变量来代替:

@Given("^I navigates to My Account page$")
        public void I_navigates_to_My_Account_page() throws Throwable {
            com.aventstack.extentreports.ExtentTest given = scenario.createNode(new GherkinKeyword("Given"), getGivenText()).info("info");

snapshot

getGivenText将收到"我导航到我的帐户页面"执行价值。我尝试找到解决方案,但没有成功。如果有人遇到这个问题并找到解决方案,请告诉我。谢谢!

0 个答案:

没有答案