xctestxcuitestxctestcasefbsnapshottestcasexcuiscreenshot

FBSnapshotTestcase vs xcuiscreenshot


I am trying to understand the use case FBSnapshotTestcase solves. We already have native apple lib named xcuiscreenshot. Whenever any UITest fails, it automatically takes screenshot of the view for reference.

FBSnapshotTestcase compares with the previously stored reference image to declare a failure of screen in terms of it desired UI.

But in practical what is the exact advantage of using FBSnapTestCase over XCUIScreenshot?


Solution

  • I use FBSnapshotTestCase because I want to snapshot from a unit test target, not a UI test target.

    The chief advantage is saving time. Instead of launching the app, attaching to it, and navigating to each screen, you can just instantiate view controllers directly.