Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Introduce AroundEachCallback #1442

Closed
mibutec opened this issue Jun 2, 2018 · 1 comment
Closed

Introduce AroundEachCallback #1442

mibutec opened this issue Jun 2, 2018 · 1 comment

Comments

@mibutec
Copy link

mibutec commented Jun 2, 2018

Overview

I wonder if there was really no request for this, but I could find no issue.

With the existing extension APIs, it is possible but clumsy to implement functions like rerunning failing test or things like:

@Test
@ExpectedException(RuntimeException.class)
pulic void testException() {
  throw new RuntimeException();
}

Something like an AroundEachCallback would be quite helpful. Usage should be something like this:

public class RerunningExtension implements AroundEachCallback {
  @Override
  public void aroundTestMethod(Executable testIncludingBeforeAndAfter, ExtensionContext context) {
    while (cnt++ < getMaxNumberOfExecutions && failureExists) {
      try {
        failureExists = false;
        testIncludingBeforeAndAfter.execute();
      } catch (Exception e) {
        failureExists = true;
      }
    }
  }
}

Related Issues

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants