-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 ability to access the current repetition of a RepeatedTest from afterEach in a custom Extension #1884
Comments
I agree that this would be useful. 👍 |
This would be very useful for us, since we use a custom extension with log4j to separate test logs into different files. Current workaround: private static final Pattern REPEATED_TEST_PATTERN = Pattern.compile("^repetition (\\d+) of (\\d+)$");
private static String parseRepetition(ExtensionContext context) {
String displayName = context.getDisplayName();
Matcher matcher = REPEATED_TEST_PATTERN.matcher(displayName);
if (matcher.matches()) {
int charCount = matcher.group(2).length();
int repetition = Integer.parseInt(matcher.group(1));
String format = "%0" + charCount + "d";
return String.format(format, repetition);
} else {
return null;
}
} |
This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. Thank you for your contribution. |
This issue has been automatically closed due to inactivity. If you have a good use case for this feature, please feel free to reopen the issue. |
My use case:
@RepeatedTest
annotation and thus the computed file name must include the repetition index.It seems the info is in RepeatedTestInvocationContext but there are 2 issues:
Related Issues
@ParameterizedTest
available to test author #1668The text was updated successfully, but these errors were encountered: