gpt4 book ai didi

eclipse - cucumber 异常创建目录失败

转载 作者:行者123 更新时间:2023-12-04 14:22:03 25 4
gpt4 key购买 nike

当我运行 MainRunner 类作为响应时,我在控制台中收到如下错误消息。我确实为文件夹设置了权限。

enter image description here

这是我的步骤类:

package CucumberFramework.steps;

import cucumber.api.java.en.Given;

import cucumber.api.java.en.Then;

import cucumber.api.java.en.When;



public class LoginSteps {

@Given("^User navigate to stackoverflow webstie$")

public void user_navigate_to_stackoverflow_webstie() throws Throwable {

System.out.println("user_navigate_to_stackoverflow_webstie");

}



@Given("^User clicks on the login button$")

public void user_clicks_on_the_login_button() throws Throwable {

System.out.println("user_clicks_on_the_login_button");

}



@Given("^User enters valid username$")

public void user_enters_valid_username() throws Throwable {

System.out.println("user_enters_valid_username");

}



@Given("^User enters valid password$")

public void user_enters_valid_password() throws Throwable {

System.out.println("user_enters_valid_password");

}

@When("^User clicks again on the login button$")

public void user_clicks_again_on_the_login_button() throws Throwable {

System.out.println("user_clicks_again_on_the_login_button");

}



@Then("^User should be taken to the sucsfull login page$")

public void user_should_be_taken_to_the_sucsfull_login_page() throws Throwable {

System.out.println("user_should_be_taken_to_the_sucsfull_login_page");

}

@Given("^User navigate to stackoverflow webstie(\\d+)$")

public void user_navigate_to_stackoverflow_webstie2(int arg1) throws Throwable {

System.out.println("user_navigate_to_stackoverflow_webstie2");

}



@Given("^User clicks on the login button(\\d+)$")

public void user_clicks_on_the_login_button2(int arg1) throws Throwable {

System.out.println("user_clicks_on_the_login_button2");

}



@Given("^User enters valid username(\\d+)$")

public void user_enters_valid_username2(int arg1) throws Throwable {

System.out.println("user_enters_valid_username2");

}



@Given("^User enters valid password(\\d+)$")

public void user_enters_valid_password2(int arg1) throws Throwable {

System.out.println("user_enters_valid_password2");

}



@When("^User clicks again on the login button(\\d+)$")

public void user_clicks_again_on_the_login_button2(int arg1) throws Throwable {

System.out.println("user_clicks_again_on_the_login_button2");

}



@Then("^User should be taken to the sucsfull login page(\\d+)$")

public void user_should_be_taken_to_the_sucsfull_login_page2(int arg1) throws Throwable {

System.out.println("user_should_be_taken_to_the_sucsfull_login_page2");

}

}

我还查看了目标文件夹的权限,并确保为所有用户授予了权限。我在 Windows 10 专业版上。我还尝试以管理员模式运行 Eclipse,但也没有帮助。

这是我的 Pom.xml https://pastebin.com/ad2qyGRH

我也试过以下方法:

运行:Eclipse 菜单 Project > Clean...

enter image description here

但没有快乐。请问有人知道是什么原因造成的吗?

亲切的问候

最佳答案

根据我的发现,plugin 对象似乎正在尝试创建 2 个名为“cucumber”的目录,而您想要的是让该对象创建一个目录和一个文件 叫 cucumber 。这是您的对象的样子:

plugin = {
"pretty",
"html:target/cucumber", //this is telling cucumber to create a folder called cucumber
"json:target/cucumber", //this is also telling cucumber to create a folder called cucumber
//even though you just need a file called cucumber.json
"com.cucumber.listener.ExtentCucumberFormatter: target/report.html"
//there is an unnecessary white space before "target" that is causing another issue
}

你要做的是:

plugin = {
"pretty",
"html:target/cucumber", //create a folder called cucumber
"json:target/cucumber.json",
//Notice the corresponding file extension (.json) telling cucumber to create a file
"com.cucumber.listener.ExtentCucumberFormatter:target/report.html"
//Notice I remove the white space at :target/report.html
}

现在代码正在创建一个名为 cucumber 的文件夹(这将包含一个显示测试结果的基本网页)和一个名为 cucumber.json 的文件(这将是相同的测试结果,但为 json 格式)

不要忘记删除那个空格!然后,该空白会创建一个名为“target”的单独文件夹(以空格开头),并将 report.html 文件放在那里,而不是与其余的报告工件放在一起。

希望这对您有所帮助!

关于eclipse - cucumber 异常创建目录失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53446128/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com