How to automatically generate snapshot

Ranorex Studio, Spy, Recorder, and Driver.
tvu
Posts: 195
Joined: Tue Apr 07, 2015 10:47 pm

How to automatically generate snapshot

Post by tvu » Tue Jul 26, 2016 11:06 pm

In the middle of my automation run, it would randomly fail to find an item on my mobile app (iOS). I run my automation via Jenkins so when I see this happening, I would look at the device and I can see the item is there. On my local desktop, I would load up Spy and I would be able to see the item on the actual device. I would load up Spy on the RunTime machine that is currently running the automation and it would be able to find the item there as well. My timeout to find the item is long enough so I can actively look from different sources while the Jenkins instance is "trying" to find the item and eventually fails. I connect to the device via WiFi.

For whatever reason, just that instance of the automation won't be able to find the item. Calling Reconnect() at the beginning of each test case doesn't seem to help either.

Is there a way to automation create a snapshot of the app whenever if fails to find an item? I am trying to figure out if the Xpath for item is not correct (i.e a variable in the Xpath is not set correctly) or if that instance of the automation lost connection to the device.

Thanks in advance.

Test Setup:
Ranorex 6.0.1
iPad Air 2, iOS 9.3.2
iPhone 6, iOS 9.3.3
RunTime machine - Windows 7
Local dev machine - Windows 8

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to automatically generate snapshot

Post by Support Team » Fri Jul 29, 2016 12:41 pm

Hi tvu,

Unfortunately, there is no out-of-the-box solution for creating snapshots in case of an error. A suitable workaround depends on your current test suite structure. In order to overcome your intention, I'd suggest having a short remote session. Therefore, please get in touch with us by email.

Thank you in advance.

Regards,
Markus (S)

johnzer
Posts: 16
Joined: Thu Aug 18, 2016 9:27 pm

Re: How to automatically generate snapshot

Post by johnzer » Fri Aug 19, 2016 2:10 pm

Just to be clear, this means that Ranorex cannot take a snapshot at runtime in case of failure? It can take a snapshot during text execution, though, correct? So if I wanted to manually verify an image, I could have it take the snapshot and then come back to that?

asdf
Posts: 174
Joined: Mon Mar 21, 2016 3:16 pm

Re: How to automatically generate snapshot

Post by asdf » Mon Aug 22, 2016 3:07 pm

Hi johnzer,

Unfortunately, I'm not exactly sure what you want to achieve. However, if you want to take a snapshot in case of a failure, you could create a code module and add this to the "Teardown"-section of your TestSuite in Ranorex Studio.

Therefore, just right-click on the TestSuite and press "Add Setup/Teardown".
Afterwards, a setup and a teardown section will be created.

Please add the following line of code in the created UserCode module.

Code: Select all

Report.Snapshot(repo.yourElement);
Now you just have to add the usercode module to the teardown section and there will be a snapshot created after the test execution. Also if there is an error in some prior steps.

I hope this helps.

Kind regards,
asdf