Skip to content

Add ability to access the current repetition of a RepeatedTest from afterEach in a custom Extension #1884

Closed

Description

My use case:

  • At the end of each test, save a video of the test in a file.
  • It has to support the @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:

  1. I don't know how to get access to that object in my afterEach, i.e. from an ExtensionContext. I guess I could use instanceof on the parent but it seems it's a TestTemplateExtensionContext so it wouldn't even work (and it feels hacky ;))
  2. Even if I were able to get access to RepeatedTestInvocationContext it doesn't contain any API to get the current repetition. The only thing it offers is a custom displayName but having to parse that to get the repetition index doesn't feel right.

Related Issues

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

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions