I have created a project in eclipse Kepler using cucumber, maven and junit runner. Also I am using log4j.properties file placed under config folder in my project. Log4j property configuration is defined as below in Base class.
PropertyConfigurator.configure("config/log4j.properties");
Profile.feature
Feature: This is a profile feature
@Testing
Scenario: this is the first scenario for Profile page
Given I open Naukri app
When I tap on "Profile Image"
Then The toolbar shows "User Profile"
RunnerTest.java
@RunWith(Cucumber.class)
@CucumberOptions(
format = { "pretty", "html:target/html/", "json:target/json/output.json"},
features = "src/test/features",
glue = "com.stepsdefination",
tags = {"@Testing"}
)
public class RunnerTest {
}
Now When i run the Profile.feature file in eclipse it shows -
java.io.FileNotFoundException: config\log4j.properties (The system cannot find the path specified)
But when I directly run the RunnerTest.java file then it works perfect.
Why my feature file is not taking the relative path. It work when I hard code the file location like 'D:\Project\Workspace\DemoCucumer\config\log4j.properties'. It not possible to change the file path every-time when location is changed.
Project Structure:
DemoCucumber
>src\main\java
>src\test\java
>config > log4j.properties
I have installed and downloaded all plugin related to cucumber in eclipse.
On Thursday, 30 April 2015 at 17:28, Zishan Paya wrote:
I have created a project in eclipse Kepler using cucumber, maven and junit runner. Also I am using log4j.properties file placed under config folder in my project. Log4j property configuration is defined as below in Base class.
PropertyConfigurator.configure("config/log4j.properties");
Profile.feature
Feature: This is a profile feature @Testing Scenario: this is the first scenario for Profile page Given I open Naukri app When I tap on "Profile Image" Then The toolbar shows "User Profile"
RunnerTest.java
@RunWith(Cucumber.class) @CucumberOptions( format = { "pretty", "html:target/html/", "json:target/json/output.json"}, features = "src/test/features", glue = "com.stepsdefination", tags = {"@Testing"} ) public class RunnerTest { }
Now When i run the Profile.feature file in eclipse it shows -
java.io.FileNotFoundException: config\log4j.properties (The system cannot find the path specified)
But when I directly run the RunnerTest.java file then it works perfect.
Why my feature file is not taking the relative path. It work when I hard code the file location like 'D:\Project\Workspace\DemoCucumer\config\log4j.properties'. It not possible to change the file path every-time when location is changed.
Project Structure:
DemoCucumber >src\main\java >src\test\java >config > log4j.properties
I have installed and downloaded all plugin related to cucumber in eclipse.
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.