-
Notifications
You must be signed in to change notification settings - Fork 7
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
Overrirde runnder tags #112
Open
janaartananselvarajan
wants to merge
2
commits into
main
Choose a base branch
from
GFENG-38438
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/main/java/com/pdsl/gherkin/filter/GherkinTagFiltererAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.pdsl.gherkin.filter; | ||
|
||
import java.util.Collection; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* This class adapts the `GherkinTagFilterer` interface to the `TagFilterer` interface. It provides | ||
* a way to use the functionality of `GherkinTagFilterer` with code that expects a `TagFilterer`. | ||
*/ | ||
public class GherkinTagFiltererAdapter implements TagFilterer { | ||
|
||
/** | ||
* The instance of the `GherkinTagFilterer` to be adapted. | ||
*/ | ||
private final GherkinTagFilterer gherkinTagFilterer; | ||
|
||
/** | ||
* Constructor for the `GherkinTagFiltererAdapter`. | ||
* | ||
* @param gherkinTagFilterer The instance of the `GherkinTagFilterer` to be adapted. | ||
*/ | ||
public GherkinTagFiltererAdapter(GherkinTagFilterer gherkinTagFilterer) { | ||
this.gherkinTagFilterer = gherkinTagFilterer; | ||
} | ||
|
||
/** | ||
* This method checks whether a collection of tags matches a given tag expression. It converts the | ||
* collection of tags to a `Set` using a `HashSet` and then delegates the logic to the | ||
* `gherkinTagFilterer.tagExpressionMatchesPickle` method. | ||
* | ||
* @param tags The collection of tags to be checked. | ||
* @param tagExpression The tag expression to match against. | ||
* @return True if the tags match the tag expression, False otherwise. | ||
*/ | ||
|
||
@Override | ||
public boolean tagExpressionMatches(Collection<String> tags, String tagExpression) { | ||
return gherkinTagFilterer.tagExpressionMatchesPickle(new HashSet<>(tags), tagExpression); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.pdsl.gherkin.filter; | ||
|
||
import java.util.Collection; | ||
import java.util.Set; | ||
|
||
/** | ||
* Determines if a test case derived from a gherkin file (i.e., a pickle) matches a particular tag | ||
* expression. | ||
*/ | ||
public interface TagFilterer { | ||
|
||
boolean tagExpressionMatches(Collection<String> tags, String tagExpression); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,16 @@ private static class PdslExtension extends PdslGherkinInvocationContextProvider | |
|
||
@Override | ||
public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts(ExtensionContext context) { | ||
String defaultTagExpression = "@comment_tag#2"; | ||
String commandLineTags = System.getProperty("tags"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use pdsl.filter.tags instread |
||
String effectiveTagExpression = (commandLineTags != null && !commandLineTags.isEmpty()) | ||
? commandLineTags | ||
: defaultTagExpression; | ||
return getInvocationContext(PdslConfigParameter.createGherkinPdslConfig( | ||
List.of( | ||
new PdslTestParameter.Builder(parseTreeListenerSupplier, | ||
AllGrammarsLexer.class, AllGrammarsParser.class) | ||
.withTagExpression("@comment_tag#2") | ||
.withTagExpression(effectiveTagExpression) | ||
.withIncludedResources(new String[] {"tags.feature"}) | ||
.build() | ||
) | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a different property than generic "tags" to avoid collisions with other frameworks:
pdsl.filter.tags