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

Could you please reconsider the addition of @RangeSource? #3946

Closed
k163377 opened this issue Sep 7, 2024 · 3 comments
Closed

Could you please reconsider the addition of @RangeSource? #3946

k163377 opened this issue Sep 7, 2024 · 3 comments

Comments

@k163377
Copy link

k163377 commented Sep 7, 2024

I have a heavy test for a very large range and am trying to parallelize this.

In doing so, I have noticed that if I use a @MethodSource, it will not be parallelized.

If this is a limitation due to circumstances specific to @MethodSource, could we introduce a @RangeSource?

In my layman's opinion, I think it would be easier to implement since the internal processing can be done in the same way as a @ValueSource.

Also, I feel that @MethodSource is a bit difficult to use in several ways, so I would like a @RangeSource in that sense.

I realize that this is a feature that has already been denied once with #851, but could you please consider it again?

@sbrannen sbrannen changed the title Could you please reconsider the addition of RangeTest? Could you please reconsider the addition of @RangeSource? Sep 7, 2024
@sbrannen
Copy link
Member

sbrannen commented Sep 7, 2024

Have you tried JUnit Pioneer's support for Range Sources?

Also, I feel that @MethodSource is a bit difficult to use in several ways, so I would like a @RangeSource in that sense.

How about using a @FieldSource?

@ParameterizedTest
@FieldSource
void range(int argument) {
	assertTrue(argument >= 110 && argument <= 200);
}

static Supplier<IntStream> range = () -> IntStream.rangeClosed(100, 200).skip(10);

I find that rather compelling and straightforward.

Thoughts?

@k163377
Copy link
Author

k163377 commented Sep 7, 2024

Have you tried JUnit Pioneer's support for Range Sources?

Sorry, I had missed this.
This is exactly what I was looking for, thank you.

How about using a @FieldSource?

Sorry, I missed this as well.
If it can run concurrently, this would be useful for my use case.

Thoughts?

I've made the point a bit vague, but I think the problem remains that the MethodSource is not executed concurrently.
However, is this a duplication of #3373?
If so, I will close it.

@sbrannen
Copy link
Member

sbrannen commented Sep 8, 2024

Thanks for the feedback, @k163377.

Have you tried JUnit Pioneer's support for Range Sources?

Sorry, I had missed this. This is exactly what I was looking for, thank you.

👍

How about using a @FieldSource?

Sorry, I missed this as well.

No worries. It's "new" since JUnit Jupiter 5.11 which was just recently released.

I've made the point a bit vague, but I think the problem remains that the MethodSource is not executed concurrently.

I don't think there's anything particular about @MethodSource with regards to parallel execution: every ArgumentsProvider for a parameterized test ends up producing a Stream of Arguments.

However, is this a duplication of #3373? If so, I will close it.

Indeed, I am closing this as a duplicate of the following.

@sbrannen sbrannen closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2024
@sbrannen sbrannen self-assigned this Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants