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

Add @CartesianEnumSource #379

Closed
scordio opened this issue Dec 3, 2020 · 5 comments · Fixed by #409
Closed

Add @CartesianEnumSource #379

scordio opened this issue Dec 3, 2020 · 5 comments · Fixed by #409

Comments

@scordio
Copy link
Contributor

scordio commented Dec 3, 2020

I am currently looking for a way to provide Enum values as input of a cartesian product test.

I understand it can be achieved with a static factory method, but having something like a @CartesianEnumSource which mimics the JUnit @EnumSource including names and mode parameters would be really nice.

If this sounds reasonable, I am happy to give it a shot (probably taking inspiration from #321).


Bonus topic: it would be also nice to have a @CartesianArgumentSource which would allow plugging in a custom ArgumentProvider implementation. Maybe this deserves a separate issue, but I'm not sure yet about its feasibility.

@Michael1993
Copy link
Member

Michael1993 commented Dec 3, 2020

How CartesianProductTest interacts with arguments sources will change soon. Once that is done, I will update the documentation to reflect these changes - i.e.: How you can write your own ArgumentsProvider for CartesianProductTest using API provided by Pioneer (it's almost like with JUnit just slightly different interfaces). This should also make implementing @CartesianEnumSource fairly trivial.

The issue as it is, is kind of blocked by the coming change, unfortunately. If you don't need this feature urgently, this will probably be implemented in about a month or so. Does that work?

Regarding the issue being feasible: Sounds great, I think the easier it is to "migrate" to CartesianProductTest from ParameterizedTest the better. 👍

@scordio
Copy link
Contributor Author

scordio commented Dec 3, 2020

Thanks for the quick feedback, good to know that something in this direction was already on the table 🙂

I would definitely wait for the change, but please do let me know if there is anything that can be picked up to accelerate.

@Michael1993
Copy link
Member

Feel free to review the PR implementing the change. All feedback is appreciated.

@scordio
Copy link
Contributor Author

scordio commented Jan 12, 2021

@Michael1993 now that #362 is merged, I would be happy to put something together to support @CartesianEnumSource, just let me know if I can go ahead with it.

@Michael1993
Copy link
Member

Sure, feel free to put something together!

@scordio scordio mentioned this issue Jan 19, 2021
13 tasks
@Michael1993 Michael1993 added this to In progress in Exploring Io Jan 26, 2021
Exploring Io automation moved this from In progress to Done Jan 26, 2021
nipafx pushed a commit that referenced this issue Jan 26, 2021
The `@CartesianEnumSource` annotation adds support for Enum constants 
to the Cartesian product test extension, mimicking the behavior of
JUnit's `@EnumSource`.

Closes: #379
PR: #409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants