I am trying to expand the testing functionality of the new user interface in Xcode 7 by taking screenshots of the current screen elements (shortcuts, images, buttons) and saving their available information for json files.
The idea is that during subsequent testing of the user interface, you can take a screenshot of the current screenshot and compare it with the existing one, the test will fail if additional or missing elements are found.
Unfortunately, application resources do not appear to be available during user interface testing, even for the right purpose, so json files cannot be downloaded for comparison. The following standard code cannot load a resource:
guard let resourcePath = NSBundle.mainBundle ().pathForResource ("StartScreenShapshot", ofType:"json") else { XCTFail ("can't load resource StartScreenShapshot") return }
I understand why Apple took this approach to the sandbox, since user interface testing should be based on what is happening on the screen, and access to the application is not needed, but the lack of access to the resource package is a pain.
So, is there a way to load local resources from an application, or in some other way locally while testing the Xcode 7 interface?
Saving files locally (automatically) will also be a big plus, saving them manually.
source share