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
Hi - I'm trying to configure some Snapshot Testing to avoid the following scenario:
1. Code is updated, causing a Snapshot Test to break, or a new Snapshot Test has been added, but hasn't been run ever.
2. While the CICD pipeline is running, the Snapshot Test cannot find a matching image, and fails, but gets saved automatically.
3. The CICD pipeline is configured to retry tests three times.
4. The Snapshot saved earlier is now used on the retry of the failed test.
5. The failed test will automatically pass, as it is reading from the automatically recorded Snapshot.
6. This pull request passes CICD, and then gets merged onto the main branch. However, the automatically recorded Snapshot does not get merged.
7. The main branch is now broken, and all new branches made off main are now missing a Snapshot, and cannot pass CICD until a fix is made and merged.
I have successfully prevented this behaviour with the following approach using inheritance/subclassing:
However, I am looking for an alternative way to do this, perhaps by editing my GITHUB ACTIONS file or by editing my fastfile. The reason I want an alternative is that I am worried about a scenario in which other people contributing to my repository might not use the NewTestCase class, and therefore this behaviour won't be enforced.
I have tried to use the SNAPSHOT_TESTING_RECORD=never env variable inside my GITHUB ACTIONS file, but to no avail. Is there something I'm missing as to how I can achieve this, or if this is still way to do it?
Alternatively if there's a way to just extend XCTestCase globally across my codebase, and enforce this behaviour to differ when tests are being run locally or on pipeline, I would also take that.
I will appreciate any advice I can get.
Thank you.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi - I'm trying to configure some Snapshot Testing to avoid the following scenario:
1. Code is updated, causing a Snapshot Test to break, or a new Snapshot Test has been added, but hasn't been run ever.
2. While the CICD pipeline is running, the Snapshot Test cannot find a matching image, and fails, but gets saved automatically.
3. The CICD pipeline is configured to retry tests three times.
4. The Snapshot saved earlier is now used on the retry of the failed test.
5. The failed test will automatically pass, as it is reading from the automatically recorded Snapshot.
6. This pull request passes CICD, and then gets merged onto the main branch. However, the automatically recorded Snapshot does not get merged.
7. The main branch is now broken, and all new branches made off main are now missing a Snapshot, and cannot pass CICD until a fix is made and merged.
I have successfully prevented this behaviour with the following approach using inheritance/subclassing:
However, I am looking for an alternative way to do this, perhaps by editing my
GITHUB ACTIONS
file or by editing myfastfile
. The reason I want an alternative is that I am worried about a scenario in which other people contributing to my repository might not use theNewTestCase
class, and therefore this behaviour won't be enforced.I have tried to use the
SNAPSHOT_TESTING_RECORD=never
env variable inside myGITHUB ACTIONS
file, but to no avail. Is there something I'm missing as to how I can achieve this, or if this is still way to do it?Alternatively if there's a way to just extend
XCTestCase
globally across my codebase, and enforce this behaviour to differ when tests are being run locally or on pipeline, I would also take that.I will appreciate any advice I can get.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions