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

[feature idea]: Rework @RunWith(FeatureVariations.class) into a @Rule #131

Closed
danhaywood opened this Issue May 8, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@danhaywood
Contributor

danhaywood commented May 8, 2015

I really like the testing support you've implemented in togglz, and the FeatureVariations concept is smart and elegant. It'd be nice if this could be reworked into a @rule, though, perhaps an enhancement to TogglzRule?

My main thought was that the TogglzRule#apply(...) could basically call base#evaluate() multiple times, one for each variation. The logic that works out the different variations (that I presume is part of the FeatureVariations runner) would just move to drive a loop inside of #apply().

The API would be something like:

@rule
public TogglzRule togglzRule = TogglzRule.allEnabled(MyFeatures.class)
.withVariations()
.enable(MyFeatures.F1)
.vary(MyFeatures.F2)
.vary(MyFeatures.F3);

or something like that.

@chkal

This comment has been minimized.

Member

chkal commented May 9, 2015

Very interesting idea. I actually like JUnit rules very much and always try to prefer them over @RunWith(). However, I'm not sure if it is possible to call base#evaluate() multiple times to create "virtual test results" that are correctly displayed in the IDE.

However, if it works, I agree that implementing a rule would be awesome. Any interest in working on a prototype for this? ;)

@danhaywood

This comment has been minimized.

Contributor

danhaywood commented May 9, 2015

Hi Christian, glad you like the idea. Hadn't thought about the impact to
an IDE, but I imagine/hope that it would just be a test from its point of
view. Have to just try it out.
Yes, I'll see if I can work on a prototype in the next week or so. Should
be interesting to try something out.
Cheers
Dan
PS: FYI am using using togglz for a new "addon" for Apache Isis, see
github.com/isisaddons/isis-module-togglz, isisaddons.org and isis.apache.org

On 9 May 2015 at 10:48, Christian Kaltepoth notifications@github.com
wrote:

Very interesting idea. I actually like JUnit rules very much and always
try to prefer them over @RunWith(). However, I'm not sure if it is
possible to call base#evaluate() multiple times to create "virtual test
results" that are correctly displayed in the IDE.

However, if it works, I agree that implementing a rule would be awesome.
Any interest in working on a prototype for this? ;)


Reply to this email directly or view it on GitHub
#131 (comment).

@chkal

This comment has been minimized.

Member

chkal commented May 10, 2015

The RunAs mechanism basically allows to run tests multiple times in a different "environment". So if you configure 4 variations, each test will be reported (in IDEs and the resulting XML files) as 4 "virtual" tests. That's a really nice JUnit feature.

However, maybe that's possible with rules too. I don't know actually. But it is worth a try.

You will find an Eclipse code format profile in the source root. If you create a prototype, it would be great if you would use it.

To be honest, I didn't know about Apache Isis. But it looks very interesting. I'll have a look at it as soon as I find some time. It's awesome that you created a Togglz plugin for it. Thanks for that. :)

@danhaywood

This comment has been minimized.

Contributor

danhaywood commented May 10, 2015

The add-on for Isis is now complete, pretty much... https://github.com/isisaddons/isis-module-togglz

I've moved onto IntelliJ after more than a decade using Eclipse... but I have Eclipse installed still and will use it for this prototyping.

Cheers

@chkal

This comment has been minimized.

Member

chkal commented May 10, 2015

Great. I'll give the plugin a try as soon as I get the chance to play with Isis.

I also switched to IntelliJ some time ago. I just imported the Eclipse code style profile into IntelliJ. So that should be fine.

@chkal chkal closed this in bc30328 May 12, 2015

chkal added a commit that referenced this issue May 12, 2015

Merge pull request #132 from danhaywood/master
Implementation of TogglzRuie with variations (as per #131)

chkal added a commit that referenced this issue May 13, 2015

atfire added a commit to atfire/togglz that referenced this issue Jul 8, 2015

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