Screenshot in teardown with no failures?

Class library usage, coding and language questions.
PBMax
Posts: 8
Joined: Mon Apr 02, 2012 7:42 pm

Screenshot in teardown with no failures?

Post by PBMax » Sun Aug 26, 2018 5:41 am

I'm using the Ranorex API in Visual Studio 2015 with Ranorex 8.2. When my test passes or fails my test cleanup runs and I always gets screenshots in the report. EnableTracingScreenshots is enabled and I didn't set the number of screenshots so I think the default is 3. Why am I getting screenshots in my teardown? I noticed in one test that there was an exception that was caught we log Info and Warning messages. We are also using Host.Local.TryFindSingle to find specific objects in test cleanup. I don't believe that code is supposed to capture a screenshot if it returns false.
                TestReport.BeginTestContainerTeardown();
                TestReport.BeginTestModule("Cleanup");
                //Code to close app
                Ranorex.Report.Info("Application Closed Successfully");
                TestReport.EndTestModule();
                TestReport.EndTestContainerTeardown();

PBMax
Posts: 8
Joined: Mon Apr 02, 2012 7:42 pm

Re: Screenshot in teardown with no failures?

Post by PBMax » Sun Aug 26, 2018 3:59 pm

I ran a larger test and it looks like the last 3 screenshots are attached for each module. I'm not sure if this is due to the first failure or not in the test suite. Is there API documentation that gives a little detail as to how this feature works?

qwertzu
Posts: 178
Joined: Wed Jan 25, 2017 11:08 am

Re: Screenshot in teardown with no failures?

Post by qwertzu » Mon Aug 27, 2018 1:36 pm

Hi PBMax,
Tracing screenshots should only be reported if your test fails. E.G. if an element during test run can't be found, Ranorex generally logs 3 screenshots.
Can you upload a compressed report report which contains the screenshots you are talking about?
regards, qwertzu

PBMax
Posts: 8
Joined: Mon Apr 02, 2012 7:42 pm

Re: Screenshot in teardown with no failures?

Post by PBMax » Mon Aug 27, 2018 4:45 pm

I've attached a screenshot instead of my actual report. If you can see, I have an Info and User log message in TearDown and got screenshots when those steps did not fail.
Attachments
RanorexFailure.jpg
RanorexFailure.jpg (130.33 KiB) Viewed 97 times

qwertzu
Posts: 178
Joined: Wed Jan 25, 2017 11:08 am

Re: Screenshot in teardown with no failures?

Post by qwertzu » Wed Aug 29, 2018 1:03 pm

Hey,
Can you show us how you implemented the closing of your application?
Thanks ;-)

PBMax
Posts: 8
Joined: Mon Apr 02, 2012 7:42 pm

Re: Screenshot in teardown with no failures?

Post by PBMax » Thu Aug 30, 2018 4:04 pm

Is there something you are looking for? A little more info would be helpful for me to investigate a little.

qwertzu
Posts: 178
Joined: Wed Jan 25, 2017 11:08 am

Re: Screenshot in teardown with no failures?

Post by qwertzu » Fri Aug 31, 2018 7:52 am

Hi,
Please post the whole code you are using in order to close the application.

regards, qwertzu