bazel-ios / rules_ios

Bazel rules for building iOS applications and frameworks
Apache License 2.0
276 stars 85 forks source link

Swift/Objc helper / demonstrate how to do hermetic snapshot loading #563

Open jerrymarino opened 1 year ago

jerrymarino commented 1 year ago

Provide some minimal code that demonstrates structuring and execute iOS snapshot tests with Bazel and rules_ios. The snapshot tests can be structured something like this - where the GoldenImages.bundle - allows easily loading of the images - or perhaps it's a symlink to the real bundle to avoid duping images.

My.app/Plugins/MySnapshot.xctest/GoldenImages.bundle`

Finally add an example to handle with "recording" snapshots in the cloud

bazel run //tests --record 

If people are checking the snaps into an external file store - illustrate how to handle this end to end: e.g. downloading the snapshot images into bazel-out - and assimilating them back into the "external" repo.

Getting a basic example / test case should separate out opinions about storing images.

jerrymarino commented 1 year ago

cc @dostrander I was thinking we could add something similar to the built in C++ snapshot lib: https://github.com/bazelbuild/bazel/blob/master/tools/cpp/runfiles/runfiles_src.h#L26 but for NSBundle. We might need extra consideration for how the remote test runner works with RBE but from an API perspective the C++ code might be a good starting point