When I run MainRunner class in response I get error message in console like below. I did set permissions for folder.
Here is my step class:
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");
}
}
I have also looked at permissions for the target folder and have ensured permissions is granted for all users. I'm on Windows 10 Pro. I also try to run Eclipse in administrator mode that didn't help as well.
This is my Pom.xml https://pastebin.com/ad2qyGRH
I have also tried the following:
running: Eclipse menu Project > Clean...
But no joy. Does anyone know what could be causing this please?
Kind regards
From what I have found, it seems that the plugin
object is trying to create 2 directories called "cucumber" when what you want is for the object to create a directory and a file called cucumber. This is what your object looks like:
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
}
What you are trying to do is:
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
}
Now the code is creating one folder called cucumber (this will hold a basic webpage that will display test results) and a file called cucumber.json (this will be the same test results but in json format)
Don't forget to remove that white space! That white space then creates a separate folder called " target" (starting with a blank space) and that puts the report.html file in there instead of with the rest of the reporting artifacts.
Hope this helps!