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
{{ message }}
Repository navigation
Is it possible to use java-snapshot-testing with Cucumber (features and steps) and Junit4? #167
Since Cucumber has its own test runner; annotating on the step class won't extend or change the cucumber test runner to be able to inject Expect expect instance variable.
Could you please share guidance/example of how to use this library in Cucumber steps? Expect expect = Expect.of() requires a java.lang.reflect.Method method which I don't think is accessible in Cucumber steps.
Cucumber uses shared steps with actual tests being written in Gherkin syntax. As there is no uniqueness with the Java Test method it won't be able to identify the comparator test correctly. You would be forced using @SnapshotName or an equivalent to uniquely identity each test - this may require some small modifications to java-snapshot-testing.
So unfortunately, unless you implement Gherkin integration and annotation it probably won't work.
You might be able to hooking the "Scenario" keyword for the snapshot name
Activity
jackmatt2 commentedon May 13, 2024
I have never tried this library with Cucumber.
Cucumber uses shared steps with actual tests being written in Gherkin syntax. As there is no uniqueness with the Java Test method it won't be able to identify the comparator test correctly. You would be forced using @SnapshotName or an equivalent to uniquely identity each test - this may require some small modifications to java-snapshot-testing.
So unfortunately, unless you implement Gherkin integration and annotation it probably won't work.
You might be able to hooking the "Scenario" keyword for the snapshot name