Reports not being logged after automation of Windows restart

Bug reports.
kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Reports not being logged after automation of Windows restart

Post by kmck » Wed Mar 26, 2014 1:36 pm

Hello,

Right now I am automating the restart of Windows after installation of a program to verify data is loaded correctly into the registry. I have used the following method, mentioned by Ciege in the link posted, to automate the restart:

http://www.ranorex.com/forum/installati ... -t835.html
1) Write to the RunOnce registry key to launch your automation app.
2) Before shutting down have your automation app write out a text file that says restart (or something just so we have it for future reference).
3) After the computer restarts and the automation app is restarted from the run once, have your automation app check for the restart text file. If it does not exist, assume this is a clean run and go accordingly. If it does exists assume that this is a restart and tell you automation app to start at the new place in code where it needs to be after a restart.
4) IF this is a restart, make sure your automation app deletes the text file after the restart or else your next clean run of the automation app will assume this is another restart.
Everything runs just as expected, however, upon completion there is no report output in either the bin/Debug folder or the project's Reports folder. I only have one report in the bin/Debug folder from the test run PRIOR to restarting, however it has absolutely no data, and the test run AFTER restarting is missing entirely.

I've attached an image of the blank report run PRIOR to restarting.

I imagine the test run prior to restarting did not record properly since the test was cut off with the restart command.

Any ideas of ways around this so I can get all the report data from both before and after restarting the computer?
Attachments
EmptyRanorexReport.PNG
Empty Ranorex Report Prior to Restarting
EmptyRanorexReport.PNG (19.11 KiB) Viewed 1148 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3936
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Reports not being logged after automation of Windows restart

Post by odklizec » Wed Mar 26, 2014 2:06 pm

There is not an easy way to continue with the test after its abrupt termination due to the windows restart. I mean, yes, you can (somehow) restart the test after window restart. You can, for example, use a text file, where you can recorded something just before performing the windows restart. Now after the windows restart, you can restart your test (using Ciege's trick) and then, as a very first step, you should read/evaluate the text file and then set your test to the step right after the restart step. So the test will in fact continue from the place, where it was interrupted.

But if I'm not mistaken, the possibility to append the existing Report file is no longer available in Rx4.x and newer. See this post...
http://www.ranorex.com/forum/how-to-app ... tml#p20129
So you will and up with two report files. First one, where will be recorded steps from the test start to windows restart and second one, where will be recorded steps after windows restart to the test end.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Re: Reports not being logged after automation of Windows restart

Post by kmck » Wed Mar 26, 2014 2:11 pm

Hello odklizec, and thanks for your response.

I understand that there will be two report files, but the issue as of now is that I am only getting one report file for the test run prior to restarting, which contains no data (erroneously, I might add -- this should have data for the validation points prior to restarting), and absolutely no report file for the tests run after the restart.

Without the report data the test is essentially rendered useless, so I need to know if there is something else I should be doing on my end to get the report data to generate, or if this is a Ranorex bug.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3936
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Reports not being logged after automation of Windows restart

Post by odklizec » Wed Mar 26, 2014 2:32 pm

I don't think it's a bug in Ranorex. The problem is that the test was forcibly terminated by windows restart and therefore, the report file has not been closed properly. What you might try is to look into your test output directory, where you may find *.rxlog and *rxlog.data_tmp files. These are autosaved report files. Simply remove _tmp from the file name and then you should be able to run the rxlog file.

Another solution could be to schedule windows restart, finish the test properly (e.g. using the sample code shown here) and then hope the scheduled restart will work ;) For scheduling restart use for example this code:

Code: Select all

System.Diagnostics.Process.Start("shutdown.exe", "-r -t 60"); 
Where 60 means restart will be initiated after 60 seconds. You can use any value between 0-600.

Considering all the work and risks from terminating the test in the middle and restarting and setting it to work from a certain step after restart, I personally would use two separate tests. The first one would set the second one to run after the windows restart (using Ciege's trick), schedule the restart and then simply end. After restart, there should be started the second test and that's all. No need to hassle with text files, setting the test to run "to" and "from" certain point, etc.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Re: Reports not being logged after automation of Windows restart

Post by kmck » Thu Mar 27, 2014 9:34 pm

Thank you odklizec, I'll give the two test/set windows to wait to restart. That would probably make it much cleaner :)

Now, I understand why the report prior to restarting would be blank, since the test was cut off abruptly. The image I provided in my original post is after I'd deleted the _tmp from *rxlog.data_tmp file. I guess I still don't understand is why, after the computer is restarted and the test is rerun from RunOnce, is there no report generated for that run?

RunOnce from the registry calls the test file explicitly and it runs through to completion after the system restarts, so there should be a report, but no report can be found. Any insight would be greatly appreciated!

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3936
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Reports not being logged after automation of Windows restart

Post by odklizec » Fri Mar 28, 2014 8:57 am

I'm afraid, I never tried to run the tests using RunOnce registry, so I don't have any clue what's the reason of missing report? Maybe it's just saved somewhere else or maybe it's deleted after finished execution?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

kmck
Certified Professional
Certified Professional
Posts: 83
Joined: Fri Jul 12, 2013 2:41 pm

Re: Reports not being logged after automation of Windows restart

Post by kmck » Fri Mar 28, 2014 1:24 pm

Hmm...I thought the same thing about it possibly being saved elsewhere, but couldn't find any report listed anywhere. Can anyone from support provide any insight?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Reports not being logged after automation of Windows restart

Post by krstcs » Fri Mar 28, 2014 2:11 pm

Have you tried adding the /rf:<Report File location and name> switch to your runonce call?

Have you made sure that the runonce call uses the full path?

Also, I think runonce doesn't have a Start In setting, so you might want to make a batch file containing the test command line that gets put in runonce (instead of the test). Then you can "cd" to the test directory in the batch file before running the test (again in the batch file) to ensure you are in the right place.
Shortcuts usually aren't...