Formatters should report feature paths as relative paths #337

Closed
aslakhellesoy opened this Issue Jun 5, 2012 · 5 comments

Comments

Projects
None yet
3 participants
Owner

aslakhellesoy commented Jun 5, 2012

See https://groups.google.com/d/msg/cukes/aeBqm6i6F6Y/MgEUjX_01KQJ

The change needs to happen in FileResource.getPath() which uses File.getAbsolutePath()

Contributor

mattharr commented Jun 5, 2012

At the moment can you not choose how features get resolved, i.e. finding it on the classpath using:

@Cucumber.Options(features = "classpath:newyork.feature",format = {"pretty", "html:target/cucumber","json:target/newyork.json" })

Which then gives short names I think?

shahb commented Jun 6, 2012

Yes, I tried using class path there

@runwith(Cucumber.class)
@Cucumber.Options(features = "src/test/resources/com/******/test/automation/newyork.feature",format = {"pretty", "html:target/cucumber","json:target/newyork.json" })
public class RunNewYorkTests {
}

This works but output is still the same.
Also I tried

@runwith(Cucumber.class)
@Cucumber.Options(features = "classpath:newyork.feature",format = {"pretty", "html:target/cucumber","json:target/newyork.json" })
public class RunNewYorkTests {
}

This didn't work:

Contributor

mattharr commented Jun 6, 2012

Maybe try this:

@runwith(Cucumber.class)
@Cucumber.Options(features = "classpath:com/******/test/automation/newyork.feature",format = {"pretty", "html:target/cucumber","json:target/newyork.json" })
public class RunNewYorkTests {
}

I'm guessing src/test/resources is on the classpath?

shahb commented Jun 7, 2012

I tried that too and tests was failed with initialization errors.

Output:

Tests in error: 
  initializationError(com.****.test.automation.RunNewYorkTests): No features found at [classpath:src/test/resources/com/****/test/automation/newyork.feature]
  initializationError(com.****.test.automation.RunStockTests): No features found at [classpath:src/test/resources/com/***/test/automation/stock.feature]

Tests run: 2, Failures: 0, Errors: 2, Skipped: 0

I even tried hard coding feature file path C:/Documents and Setting/....../newyork.feature. Tests were passed but JSON report had absolute path in "uri"

Owner

aslakhellesoy commented Jun 7, 2012

Folks, I have outlined the solution above. The various tweaks you're proposing isn't going to fix this in a reliable way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment