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

Remove tag test block filter from core #127

Conversation

phillcunnington
Copy link
Member

When trying to implement a "chunking" test block transform we realised that the tag filtering was always done by Cuppa afterwards so the chunks of tests where not evenly disributed, dependent on the tags being run.

To allow the "chunking" to be done after the tag filtering this change pulls the TagTestBlockFilter out of the list of core transforms so that it can be applied by the CuppaConfigurationProvider in the desired order.

@joebandenburg
Copy link
Member

Let me know when this is ready for review and I'll take a look.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 89.075% when pulling f140779 on phillcunnington:remove_tag_test_block_filter_from_core into 24f7c0a on cuppa-framework:master.


Configuration() {
Configuration(Options runState) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im thinking it would be nice for the test transform to know what state it expects and for the ConfigurationProvider just to state that the test transform is to be used in a specified order rather than expect the ConfigurationProvider to know what state the test transform needs...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this decouples things nicely. Good thinking!

@coveralls
Copy link

coveralls commented Aug 30, 2017

Coverage Status

Coverage decreased (-0.4%) to 90.376% when pulling 6fc60fb on phillcunnington:remove_tag_test_block_filter_from_core into 2bba98f on cuppa-framework:master.

Copy link
Member

@joebandenburg joebandenburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I'm in support of this change. However, it looks to me like this change will require users to make code changes in order to continue to use tag filtering. If that's the case, then this is a quasi API-breaking change and we should probably bump the major version number. To compound the problem, in some cases the code change required would be to introduce a ConfigurationProvider, which I've always considered a more advanced use of Cuppa.

I think the changes you've made around runtime-provided options is good and should stay.

Is there a different approach that would allow us to maintain tag filtering as an out of the box feature?
For instance, perhaps we could add a method to Configuration that lets the user opt-out of the default transforms. For instance, in your ConfigurationProvider:

configuration.disableBuiltinTransforms();

Another approach could be to say that the use of registerTestTreeTransform implicitly disables built-in transforms. This is still an API-breaking change, but it would only affect users who are already using their own transforms, which I hope is a minority of users.

If we go down this path, I'd prefer to only allow the user to disable all built-in transforms rather than making a special case for the tag filtering.

WDYT?

*/

/**
* Test block filters.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider expanding on this javadoc a little. Perhaps:

This package contains common transforms that you can to use by adding them in your ConfigurationProvider.

/**
* Tag run state to perform tag based filtering with.
*/
public static final class RunState extends Option<Tags> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name seems a little generic to me. Why did you go for RunState over something like FilteredTagsOption?


private final List<Function<TestBlock, TestBlock>> coreTestTransforms;
private final Configuration configuration;
private final Options runState;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer to call this runOptions or runParameters, but I'm fine with the current name if you like it.


Configuration() {
Configuration(Options runState) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this decouples things nicely. Good thinking!

@mrpotes mrpotes force-pushed the remove_tag_test_block_filter_from_core branch from d53a88d to 6fc60fb Compare September 24, 2019 09:09
* <li>{@link org.forgerock.cuppa.internal.filters.EmptyTestBlockFilter}</li>
* </ul>
*/
public void removeCoreTestTransforms() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about withoutCoreTransforms which returns a new Configuration instance?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To do that would still involve a change to the public API of ConfigurationProvider, so I would prefer not to...

@mrpotes mrpotes merged commit 2403410 into cuppa-framework:master Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants