Checking when an application has opened - task manager

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
missmarple
Posts: 7
Joined: Thu Nov 21, 2013 3:37 pm

Checking when an application has opened - task manager

Post by missmarple » Thu Nov 21, 2013 3:57 pm

Hi,

I need to automate a test case which opens an Excel document from an email archiving system. The problem is: how do I measure - reliably - the time taken between the double-click on the document link in the archiving system and the moment when Excel has fully loaded the document ?
My ideas so far:
- open task manager, take a DateTime snapshot when double-clicking, and when Excel has appeared in the list, take a DateTime snapshot again. I haven't tried it yet, but it seems "laggy" to me.
- create a bespoke little app (C# or similar) which encapsulates all steps. Problem: that's not longer proper automation, rather, a Ranorex-triggered hack ;-) (I'd like it more maintainable...)
- Some Ranorex API magic - haven't found anything so far...

Any hints ladies and gents ? Thanks in advance !

Miss Marple

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

Re: Checking when an application has opened - task manager

Post by krstcs » Thu Nov 21, 2013 4:53 pm

Note that Ranorex is not a performance tool, so it may not be consistent, or reliable, for pure timing testing. With that understanding you might be able to do the following.

In a single module:
1. Start Excel with the associated file/path as an argument (or click the link, or whatever you do to get Excel to open the file you need...).
2. Use a validation action to validate that Excel is open and the file is visible and open.

The report will show the time that the module started and the time each action, including the validation, happened, which should give an indication of the time it took.
Shortcuts usually aren't...

Swisside
Posts: 92
Joined: Thu Oct 10, 2013 10:40 am

Re: Checking when an application has opened - task manager

Post by Swisside » Thu Nov 21, 2013 5:06 pm

Hello

I think krstcs provided a pretty nice solution.


if you need the duration (between the doubleclick and the document being loaded) for the rest of your test you could use this
public void test()
		{
			repo.myItem.DoubleClick();
			System.DateTime startTime = System.DateTime.Now;
			System.DateTime endTime = System.DateTime.Now;
			
			bool b = repo.myExcelSheet.Visible;
			while(true){
				if (b)
				{
					endTime = System.DateTime.Now;
					break;
					
				}
			}
			TimeSpan duration = endTime-startTime;
			Report.Log(ReportLevel.Info,duration.Seconds.ToString()+"."+duration.Milliseconds.ToString()+" seconds to start the document");
				
		}
It seems pretty accurate so far and not laggy (I tested the doubleclick from the Windows Explorer so your situation might differ)

Of course as-is the code snipset isn't easy to maintain but I'm pretty sure you cannot do it without using code.

Regards
A simple thank you always does wonders !

missmarple
Posts: 7
Joined: Thu Nov 21, 2013 3:37 pm

Re: Checking when an application has opened - task manager

Post by missmarple » Mon Nov 25, 2013 12:30 pm

Thanks for the suggestions - will try it out right now and post feedback on results.
And yes - we're shoehorning Ranorex into a performance test situation... we tried on the protocol level and just couldn't get it to work. GUI is the only way we can measure response times, and the project have accepted that this is not going to be a correct-to-the-nanosecond kind of affair (I think) :)

missmarple
Posts: 7
Joined: Thu Nov 21, 2013 3:37 pm

Re: Checking when an application has opened - task manager

Post by missmarple » Fri Nov 29, 2013 1:01 pm

Hi,

in the end, this sufficed:

1.) Launch Excel download (and open) via return key and then measure with

2.)
while(repo.MicrosoftExcel.Self.Active == false)
{
Thread.Sleep(100);
}

Thanks for the suggestions !

Regards,
MM