Skip to content

[Core] Formalize glue and feature paths #1544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 3, 2019

Conversation

mpkorstanje
Copy link
Contributor

@mpkorstanje mpkorstanje commented Jan 26, 2019

Summary

Feature Path

The feature path was poorly defined. It could either be a path or
a path with a classpath: prefix. This ambiguity allowed room
for various inconsistencies and misinterpretations.

  1. Pickle URI's were not actually uniform. Depending on operating
    system different path seperators would be used.

  2. Pickle URI's did not identify a resource. The classpath:
    prefix would be dropped after loading a feature file. This
    lead to a fairly complex try-catch-try-again-on-the-classpath
    mechanism when loading rerun file.

By properly defining the feature identifier it becomes possible to
parse it in RuntimeOptions and propagate a consistent URI to
other parts of cucumber-jvm. This reduces the need for work
arounds in various places.

Features are identified by a URI. This URI can either be absolute:
scheme:/absolute/path/to.feature, or relative to the
current working directory:scheme:relative/path/to.feature.

In either form, when the scheme is omitted file will be
assumed: path/to.feature.

On systems that use a File.separatorChar other then /
File.separatorChar can be used as a path separator. When
doing so when the scheme must be omitted: path\to.feature.

It is recommended to use / as the path separator.

Fixes: #1547

Glue Path

Likewise the feature path was poorly defined. It could be a resource
name, a classpath URI or a file path. This ambiguity allowed room
for various inconsistencies and misinterpretations.

The glue path can now be written as either a package name: com.example.app
a path com/example/app or uri classpath:com/example/app.

On file system with a path separator other then / com\example\app
is also a valid glue path.

It is recommended to always use the package name form.

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@mpkorstanje mpkorstanje force-pushed the refactor-resource-loading branch 3 times, most recently from 4b35d68 to 95541c6 Compare January 26, 2019 13:59
@mpkorstanje mpkorstanje changed the title Formalize feature path [Core] Formalize feature path Jan 26, 2019
@mpkorstanje mpkorstanje force-pushed the refactor-resource-loading branch 2 times, most recently from 407ad15 to 8e02410 Compare January 27, 2019 15:34
The feature path was poorly defined. It could either be a path or
a path with a `classpath:` prefix. This ambiguity allowed room
for various inconsistencies and misinterpretations.

1. Pickle URI's were not actually uniform. Depending on operating
   system different path seperators would be used.

2. Pickle URI's did not identify a resource. The `classpath:`
   prefix would be dropped after loading a feature file. This
   lead to a fairly complex try-catch-try-again-on-the-classpath
   mechanism when loading rerun file.

By properly defining the feature identifier it becomes possible to
parse it in `RuntimeOptions` and propagate a consistent URI to
other parts of cucumber-jvm. This reduces the need for work
arounds in various places.

Features are identified by a URI. This URI can either be absolute:
`scheme:/absolute/path/to.feature`, or relative to the
current working directory:`scheme:relative/path/to.feature`.

In either form, when the scheme is omitted `file` will be
assumed: `path/to.feature`.

On systems that use a `File.separatorChar` other then `/`
`File.separatorChar` can be used as a path separator. When
doing so when the scheme must be omitted: `path\to.feature`.

It is recommended to use `/` as the path separator.
@mpkorstanje mpkorstanje force-pushed the refactor-resource-loading branch from 8e02410 to 032f8f2 Compare February 1, 2019 21:20
@coveralls
Copy link

coveralls commented Feb 2, 2019

Coverage Status

Coverage decreased (-0.2%) to 86.029% when pulling fafe09f on refactor-resource-loading into 5d062e7 on master.

@mpkorstanje mpkorstanje changed the title [Core] Formalize feature path [Core] Formalize glue and feature paths Feb 3, 2019
 The glue path is a class path URI to a package.

 The glue path can be written as either a package name: `com.example.app`
 a path `com/example/app` or uri `classpath:com/example/app`.

 On file system with a path separator other then `/` `com\example\app`
 is also a valid glue path.

 It is recommended to always use the package name form.
@mpkorstanje mpkorstanje force-pushed the refactor-resource-loading branch from 84c147b to fafe09f Compare February 3, 2019 12:19
@mpkorstanje mpkorstanje merged commit af877c4 into master Feb 3, 2019
@mpkorstanje mpkorstanje deleted the refactor-resource-loading branch February 3, 2019 20:39
@lock
Copy link

lock bot commented Feb 3, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] Line filtering fails on Windows
2 participants