You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently our framework is deeply integrated into the whole test execution life cycle. We rely on several information that are provided by JUnit:
We use the test method for determining snapshot names from SnapshotNaming strategy
We use the number of executed assertions within the same test method for automatic snapshot naming
We use the test method and the test class to check for presence of @ForceUpdateSnapshots and @DeleteOrphanedSnapshots annotations
We use the test class to determine the default snapshot directory.
We collect information about failed and skipped tests to improve orphan detection
Those are the main reasons why we currently can not offer a simple static assertThat(actual).matchesSnapshotText() API.
We could try to find heuristics to determine the currently required information.
A simple soultion would be to try to determine the surrounding test class by iterating the current call stack and to rely on manual snapshot naming. That would allow to write assertions like this:
Relying on manual snapshot naming is not sufficient. The header part must contain the real name of the method, otherwise it will always be determined as orphaned by the StaticOrphanDetector. Or we need to introduce yet another header field that indicates the mismatch between the manual name and the real test method.
Currently our framework is deeply integrated into the whole test execution life cycle. We rely on several information that are provided by JUnit:
SnapshotNaming
strategy@ForceUpdateSnapshots
and@DeleteOrphanedSnapshots
annotationsThose are the main reasons why we currently can not offer a simple static
assertThat(actual).matchesSnapshotText()
API.We could try to find heuristics to determine the currently required information.
A simple soultion would be to try to determine the surrounding test class by iterating the current call stack and to rely on manual snapshot naming. That would allow to write assertions like this:
The text was updated successfully, but these errors were encountered: