facebookarchive / ios-snapshot-test-case

Snapshot view unit tests for iOS
MIT License
2.66k stars 253 forks source link

show compared screenshots in Jenkins #211

Open mgehlen opened 7 years ago

mgehlen commented 7 years ago

Hello,

we are using snapshot-test-case wuth great success in our iOS testing - thank you very much for a splendid tool.

We use Jenkins in a Master-Slave setup as our build server and have several Macs as slaves in this setup. As it shockingly happens from time to time some tests actually fail.

In this case it would be helpful to quickly identify what happened if we had the compared screenshots in our Jenkins Report.

The current report includes image information about the compared pictures thanks to #146:

Error Message

failed - Snapshot comparison failed: Optional(Error Domain=FBSnapshotTestControllerErrorDomain Code=4 "Images different" UserInfo={NSLocalizedFailureReason=image pixels differed by more than 0.00% from the reference image, FBDiffedImageKey=<UIImage: 0x7f915f8714a0>, {320, 568}, FBReferenceImageKey=<UIImage: 0x7f915fc00fb0>, {320, 568}, FBCapturedImageKey=<UIImage: 0x7f915fd2f540>, {320, 568}, NSLocalizedDescription=Images different}) Stacktrace

MyApp/MyAppTests/BaseSnapshotTestCase.swift:131

Is there any way that I can fetch the images with this information and actually show them in the failed test case report on Jenkins? Have any of you done this or build a helper, which did this?

Help is very much appreciated.

Thank you very much.

nemoeslovo commented 7 years ago

There is a fork of the Second Curtain library that can solve your problem. Original Second Curtain was designed in a way when screenshots were uploaded to the AWS, but this fork just collects pictures in folder with html generated, so you can archive this report on your CI.

mgehlen commented 7 years ago

thank you, I will have a look at it.

pres commented 7 years ago

Just set the IMAGE_DIFF_DIR to a folder the Jenkins has access to and archive the folder in the Jenkins job.