Welcome to MSDN Blogs Sign in | Join | Help

The Cat Parade

It has been said that trying to keep Hopper focused on a single application is like trying to get cats to walk in a parade (very difficult). The problem is Hopper is designed from its foundation to stress the entire system and never stay in one place too long – its job is to move around. Generally this is a good thing, but if you are trying to isolate a problem or your intent is to stress a particular application (if you are an ISV), it can be frustrating to watch Hopper navigate away from your application and find bugs that are not of interest of you. Hopper does have a built-in option (/a) to help with this, but it can be awkward and sometimes frustrating. 

 

I have coded a sample alternative below that simply sits in a tight loop, re-executing the application you want to keep Hopper banging on. The code loops and continually re-launches the application you want to test (this sample focuses on Media Player) and sleeps for a specified period. Using the below, it is possible Hopper will navigate away from your application but once the time duration expires, your application will be switched to front and again receive the brunt of Hopper's fury. I would consider the below bare-bones test code, but it should be sufficient to help you write and customize your own program that does what you need.

 

#include <windows.h>

 

#define ONE_SECOND      1000

#define TEN_SECONDS     (10 * ONE_SECOND)

#define TWENTY_SECONDS  (2 * TEN_SECONDS)

#define ONE_MINUTE      (3 * TWENTY_SECONDS)

#define FIVE_MINUTES    (5 * ONE_MINUTE)

#define FIFTEEN_MINUTES (3 * FIVE_MINUTES)

 

// Adjust the following to suit your needs

#define SLEEP_TIMEOUT TWENTY_SECONDS

TCHAR *g_pszAppName = TEXT("\\windows\\wmPlayer.exe");

 

//------------------------------------------------------------------------------

int WINAPI

WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,

    LPWSTR lpCmdLine, int iCmdShow)

{

    TCHAR tszTmp[MAX_PATH];

    PROCESS_INFORMATION piProcInfo;

 

    while(TRUE)

    {

        wsprintf(tszTmp, TEXT(" ... Relaunching: %s"), g_pszAppName);

        OutputDebugString(tszTmp);

        if(! CreateProcess(g_pszAppName, NULL, NULL, NULL, FALSE, 0, NULL,

                NULL, NULL, &piProcInfo))

        {

            goto Error;

        }

 

        // Adjust this value to suit your needs above

        Sleep(SLEEP_TIMEOUT);

    }

Error:

    // Error condition - should never get here.

    wsprintf(tszTmp, TEXT("ERROR: could not launch %s, last error: %d"),

        g_pszAppName, GetLastError());

    OutputDebugString(tszTmp);

    return(TRUE);

}

 

 

To use this test application, you will need to copy the above to a .cpp file and add a sources and makefile. Change the p_pszAppName to point to the binary you want Hopper to focus on and build within your environment. Once signed with an appropriate certificate you simply run it before starting Hopper. A big benefit from using this test loop is your applications’ multiple-instance logic is thoroughly tested so you won’t have any surprises later. It should also be said that any sample code published on this site carries no warranties either implied or expressed and the code is to be used at your own risk. Enjoy!

Published Wednesday, November 30, 2005 12:20 AM by shende
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: The Cat Parade

Thursday, December 01, 2005 11:37 AM by RoboForm
Good Tricks!

This time my question is:
Is the Hopper.exe for the Smartphone same as the one for the Pocker PC(phone edition)?

The hopper.exe on my PPC board always run 33mins with the result "Start Menu no respond". and I follow the instructions on Doc: running hopper with KITL,when the first time the "Start menu no responding loop 1..." appears in the output panel, I break it, and Load NKdebug.dll,run "Allthreads sleeplist runlist" commands and so on. I got a lot of "PID/TID/Callstacks" but I don't know how to use these infomation to find the causation.
How to analyse it?
Where can I find the documents(or Hands-on-labs) about this topic?

I am a newbie. Thanks!

# re: The Cat Parade

Tuesday, December 27, 2005 4:09 PM by Vivek
Great tool ! Works with smartphone too.

Brings the targetted app (POutlook ->Tasks) in my case every so often even though Hopper is running wild.

Thanks Steve !!!

# re: The Cat Parade

Monday, June 05, 2006 12:28 PM by shende

What is a “Cat Parade”?

My apologies for anyone who does not recognize the reference – I try to make my titles memorable so they can easily be remembered. A “Cat Parade” refers to trying to make cats (the animals) try to walk in a straight line, or try to get them to do anything they don’t want to do – impossible!

It’s the same way with trying to get Hopper to stay in a single place – its almost impossible because it was designed to do just the opposite. Hopper wants to traverse the entire system looking for bugs – the Cat Parade will allow you to reign in Hopper so it stays (mostly) in a single place.

# re: The Cat Parade

Monday, June 05, 2006 10:46 PM by Klein
Good tool!!

But why not update Hopper and check application name after each key press? If the application name changed, back to the application you want to test again.

# re: The Cat Parade

Tuesday, June 06, 2006 11:37 AM by shende
Ah! Good question and I am glad you brought it up. I have been thinking of how useful an “exclusive mode” could be and I keep coming back to the fact that I want to know the device can switch still to another app. I fear that having an exclusive mode would allow certain app hangs to go unchecked – and I want to know when I can’t dismiss the foreground window. I also like the way the focusApp above hammers on the instance checking – there is no way to run the above without rock-solid instance checking.

However, that is just one opinion and should not indicate your suggestion is any less valuable – it is up to the OEM and ISV to best determine how to test their products. Off the top of my head, there are two ways to do exclusive mode:

1. Easy way: I would take the above focusApp sample and I would replace the timer with logic to monitor the foreground window. You would need to populate some list that contains the names of all your windows and whenever the foreground window does not match this list, re-launch your app. This would not be exclusive, but could get you close with +/- 20 minutes of work.
2. less-easy way: Use the above method, but instead of using Hopper find my blog entry “Roll your own Hopper in 200 lines of code – sample included!” and build your own input stress tool to test your application. While this would take more time, you could guarantee exclusivity since you would have more (complete) control over the test application. Also, you could add intelligence to the tool to do real things with your application and stress it in ways that Hopper couldn’t – you could actually do stuff.

The bottom line is using any focus method on your app will allow you to increase your stability and not affect the platform during Hopper testing.

# re: The Cat Parade

Tuesday, June 20, 2006 10:59 AM by shende
(housekeeping comment)
It appears that some porn-bot has this URL. I have been trying to delete them as they arrive, but I apologize in advance if off-topic content is visible.

# re: The Cat Parade

Thursday, September 21, 2006 12:31 PM by dfgdgaw
http://www.bloggen.be/rosarybracelets <a href="http://www.bloggen.be/rosarybracelets">rosary bracelets</a> rosary bracelets

# re: The Cat Parade

Friday, September 22, 2006 12:55 PM by yaasel
http://www.bloggen.be/zend/ <a href="http://www.bloggen.be/zend/">replica watches</a> replica watches

# re: The Cat Parade

Monday, September 25, 2006 4:27 AM by Pinouk

# re: The Cat Parade

Sunday, October 01, 2006 12:19 PM by Henry

# re: The Cat Parade

Wednesday, October 11, 2006 2:39 PM by halloween

http://blogshot.nl/halloween <a href="http://blogshot.nl/halloween">Halloween costume</a> Halloween costume

# re: The Cat Parade

Saturday, October 14, 2006 1:16 AM by dresses

http://qurl.com/rzbyc <a href="http://qurl.com/rzbyc">replica watches</a> replica watches

# re: The Cat Parade

Sunday, November 12, 2006 5:14 PM by Christmas gifts

# Improving the Cat Parade (Part 1)

Monday, November 27, 2006 6:22 PM by HoppeRx - the cure for your ailing device

The focusapp described in a previous blog entry The Cat Parade is a great way for ISVs to get additional

# re: The Cat Parade

Monday, January 08, 2007 7:44 AM by replica watches

http://rw.da.cx  <a href="http://rw.da.cx">replica watches</a> replica watches

# re: The Cat Parade

Thursday, May 03, 2007 6:15 PM by sgn7edu240

13gsksbg236a8 <a href = http://www.1097490.com/861874.html > iwa2rme6a </a> [URL=http://www.699315.com/668267.html] 65i32cjw [/URL] 7lc0vw2o8ap

# re: The Cat Parade

Thursday, May 03, 2007 6:16 PM by wmhcrmh6k2

1c7b40k231y9xxi22 <a href = http://www.866783.com/283022.html > qbggm5sb96g20 </a> [URL=http://www.885327.com/581986.html] k0xm2ivsjx853pa [/URL] c0xuc15rmdrqd66b

# re: The Cat Parade

Sunday, May 06, 2007 9:26 PM by i0lhj35old

a5c3y5gyxs657cc <a href = http://www.312411.com/361178.html > rye78xrs0evwcf </a> [URL=http://www.1055072.com/778110.html] ixvuuy680md7 [/URL] qe3zvk3k

# re: The Cat Parade

Sunday, May 06, 2007 9:27 PM by 0fpv7sm1qm

0q8dz6kg7ud <a href = http://www.725906.com/779091.html > vg7m694q3b154q </a> [URL=http://www.682502.com/205149.html] eyaw602wcvqpq5ojv [/URL] 0oaa0bko4r47att62

# re: The Cat Parade

Monday, May 07, 2007 12:10 AM by 9l5v9j1fd6

23q6iejy8ypzj <a href = http://www.448935.com/892936.html > e8fek4e164asq0 </a> [URL=http://www.911431.com/543645.html] j1ko8gx7i2 [/URL] 3qjhrc2c8by7f

# Hopper for ISV’s – part I

Tuesday, May 15, 2007 11:47 AM by HoppeRx - the cure for your ailing device

I have been reflecting on the things Javier and I learned from our Hopper talk at MEDC and I wanted to

# re: The Cat Parade

Monday, May 21, 2007 9:47 AM by ujr9euz482

wyepb33h <a href = http://www.623440.com/666550.html > 90lpwglqcm88frpt7 </a> [URL=http://www.167402.com/126630.html] rmzudhtlgd6nptg [/URL] e5bjwpiitv79

# re: The Cat Parade

Tuesday, May 22, 2007 7:37 PM by platinum blondes

platinum blondes - [URL=http://gerryconstantineij.netfirms.com/platinum-blondes.html ] platinum blondes [/URL] kitchen flooring - [URL=http://utenti.lycos.it/karinxanthushc/kitchen-flooring.html ] kitchen flooring [/URL]

# re: The Cat Parade

Monday, June 04, 2007 9:32 PM by rnkvptaavr

itjn4onwg9 <a href = http://www.253974.com/970050.html > 5lod4g96t90y </a> [URL=http://www.869929.com/563608.html] chpkopmjf [/URL] thwzrdj525gbb8s

# Improving the Cat Parade (Part 2)

Thursday, September 27, 2007 4:32 PM by HoppeRx - the cure for your ailing device

There have been a few blogs that talk about the benefit of focusing hopper runs on individual applications

# Improving the Cat Parade (Part 3)

Friday, October 05, 2007 4:11 PM by HoppeRx - the cure for your ailing device

I was recently running hopper on a device that supported screen rotation and I realized that my test

# Good site

Thursday, March 06, 2008 5:52 PM by jtbkr

<a href=" http://school-ut3.0catch.com/ ">Bible high school literature</a>

# Good site

Saturday, March 08, 2008 10:52 AM by mqhrp

<a href=" http://hotel-2-df4.0catch.com/ ">Omni chicago hotel</a>

# re: The Cat Parade

Wednesday, May 07, 2008 10:32 PM by HongHeng

Hi, i'm confused, probably because i'm a newbie.

-I have a smartphone application.

-i edited the focusapp, the application.exe path is set to the g_pszAppName, yet i couldn;t make it to build for wm6 std instead of wm6 pro.

-i copy hopper to the root of wm6 std device.

-i copy focusapp.exe(wm6 pro build) to the root as well.

-i deploy my app from VS2005

-i run focusapp.exe.. and didnt indicate that it is running or not.. nm

-then i run hopper.exe

outcome :

outcome:

"Unable to create/open the log file. Please make sure the log is not opened already and restart the test."

"Error accessing log file. Test will not continue."

but i didn't open any log file.. or the steps i did were wrong?

# re: The Cat Parade

Thursday, May 08, 2008 10:23 PM by limhh82

finally i got it run.. the problem is the version of the Hopper.exe, it was for pocket 2003, now i'm using the latest one..

but.. sigh.. another problem.. the test ended in 6 mins time.. n the reason is "start menu dead, not responding.

# re: The Cat Parade

Tuesday, June 10, 2008 9:36 AM by cranti

can any one suggest me how to stop the hopper test which is running? Please suggest me different ways of stopping it and how to analyse logs of it.

i am Test Engineer testing Windows Mobile 6 Pro

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker