Skip to content
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

Refactor Runtime.filters and matchesFilters out of Runtime #1352

Closed
mpkorstanje opened this issue Apr 23, 2018 · 2 comments
Closed

Refactor Runtime.filters and matchesFilters out of Runtime #1352

mpkorstanje opened this issue Apr 23, 2018 · 2 comments
Assignees
Labels
good first issue Good for newcomers 🙏 help wanted Help wanted - not prioritized by core team 🧷 pinned Tells Stalebot not to close this issue

Comments

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Apr 23, 2018

To make the first baby steps towards implementing a Cucumber Runner for JUnit 5 we'll need to make it possible to filter a list of features without creating a Runtime instance.

Currently Runtime assembles Runtime.filters internally from RuntimeOptions but only accesses it through Runtime.matchesFilters. This should make it possible to extract Runtime.filters and Runtime.matchesFilters in to Filters class.

It'd be also useful to create a Filters.getFilters() class that handles the creation of a list of filter. This is currently done in Runtime through.

        this.filters = new ArrayList<PicklePredicate>();
        List<String> tagFilters = runtimeOptions.getTagFilters();
        if (!tagFilters.isEmpty()) {
            this.filters.add(new TagPredicate(tagFilters));
        }
        List<Pattern> nameFilters = runtimeOptions.getNameFilters();
        if (!nameFilters.isEmpty()) {
            this.filters.add(new NamePredicate(nameFilters));
        }
        Map<String, List<Long>> lineFilters = runtimeOptions.getLineFilters(resourceLoader);
        if (!lineFilters.isEmpty()) {
            this.filters.add(new LinePredicate(lineFilters));
        }

Desired dependency graph:

RuntimeOptions <--- Filters <--- Runtime (use constructor dependency injection)
@mpkorstanje mpkorstanje added 🙏 help wanted Help wanted - not prioritized by core team good first issue Good for newcomers 🧷 pinned Tells Stalebot not to close this issue labels Apr 23, 2018
mpkorstanje added a commit that referenced this issue Jun 5, 2018
[Core] Refactor Runtime

Extracting:
    Backend creation,
    Glue creation,
    Runner creation
    Feature compilation

from the runtime allows

    Tests on runners to skip the creation of Runtime
    Makes extracting Filter provider(#1352) and Feature provider(#1366) easier.
    Other runtimes such as JUnit and TestNg to skip the creation of the runtime
    --parallel (#1357), junit 5 (#1149) and pickle runner support.
    Clarifies the execution loop of Cucumber
@mpkorstanje
Copy link
Contributor Author

This partially been done by 56c3477

However addLineFilters is duplicated a few times and suffers from a primitive obsession.

@lock
Copy link

lock bot commented Aug 28, 2019

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 Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers 🙏 help wanted Help wanted - not prioritized by core team 🧷 pinned Tells Stalebot not to close this issue
Projects
None yet
Development

No branches or pull requests

2 participants