Hey Everyone, sorry I have been gone for so long. Been real busy with a new job and life in general.
I’ll keep this post short and simple.
Many of us would like some kind of visual indication or guidance as to why our testing fails. This can be especially hard when
automating native apps on physical devices. Fortunately, Calabash 2.0 has a real clean solution that is easy to implement: screenshot_embed
Here is what screenshot_embed
does(found in screenshot.rb, here):
Pretty cool, right?
All we have to do is add that method into our after hook for cucumber and that’s it.
Here’s how i did it. calabash generate
generates a nice scaffold for us to get running, here is the after hook it generates:
We are going to add our embed_screenshot
method like this:
We only want to show screenshots on failures, that’s why we wrap it around the scenario.failed? if-block.
They will appear under your failed scenario as such:
Now go get testing and check if your screenshots are working(by making them fail)!