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!

Comments (34)

  1. RoboForm says:

    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!

  2. Vivek says:

    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 !!!

  3. shende says:

    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.

  4. Klein says:

    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.

  5. shende says:

    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.

  6. shende says:

    (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.

  7. dresses says:

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

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

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

  10. sgn7edu240 says:

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

  11. wmhcrmh6k2 says:

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

  12. i0lhj35old says:

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

  13. 0fpv7sm1qm says:

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

  14. 9l5v9j1fd6 says:

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

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

  16. ujr9euz482 says:

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

  17. 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]

  18. rnkvptaavr says:

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

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

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

  21. jtbkr says:

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

  22. mqhrp says:

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

  23. HongHeng says:

    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?

  24. limhh82 says:

    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.

  25. cranti says:

    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

  26. Ravi says:

    what are the avalible command line arguments that we can use along with hopper test.

    can any one brief on each command line arugument of hopper, what it does?

    Thanks

    Ravi.

  27. Mehul Adhiya says:

    Hello,

    Can anyone tell me that how to stop hopper.exe. My problem is how to check log file if hopper has created. I cannot opened it while it is running. Please suggest me the solution.

  28. Sean says:

    You can connect your Device to your PC over ActiveSync or WMDC and than start the RemoteProvessViewer (Located under "Start"->"Microsoft Visual Studio 200x"->"Visual Studio Remote Tools" Folder). There you can terminate the process.