How do you clear a message from Microsoft Project when TestPartner is frozen
I asked a similar question a while back, but I think it was too hard for anyone to help me solve since I was referring to my application under test specifically (see http://www.qaforums.com/cgi-bin/foru...=25;t=000718). But I am able to simplify this down quite a bit, and hope that perhaps someone will know what to do to help.
Before you can recreate this problem, you need to create a project in Microsoft Project as follows (the point of creating this project is to get a dialog to appear later on when we import it):
* NOTE that steps are for Microsoft Project 2003
- Start Microsoft Project. You should have a blank new project by default
- Choose "Project > Project Information" menu. The "Project Information for 'Project1'" dialog will appear.
- Set the "Start Date" to January 1, 2004. Yes, well over a year ago.
- Set the "Current Date" to January 1, 2004 as well.
- Change the "Schedule from" value from "Project Start Date" to "Project Finish Date".
- Set the "Finish Date" to December 31, 2004.
- Change the "Schedule from" value back to "Project Start Date".
- Click OK. The dialog will close.
- Enter a new task with a start date of January 1, 2004 and a duration of 262 days, which will give you a finish date of December 31, 2004. (Maybe in your country you have different default days off and holidays, so perhaps it won't be exactly 262).
- Save this Project on the root of your drive and call it "MyProject.mpp"
- Shut down Microsoft Project.
Now, start TestPartner and create a new script. Add a reference to the "Microsoft Project 11.0 Object Library"
Use the following code in the new script, making changes to location of Project or Project File if necessary:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Sub Main()
Dim dblRet As Double
Dim sPathToMSP , sPathToFile as String
sPathToMSP = "C:\Program Files\Microsoft Office\OFFICE11\WINPROJ.EXE"
sPathToFile = "C:\MyProject.mpp"
dblRet = Shell(sPathToMSP , vbNormalFocus)
If dblRet = 0 Then Exit Sub
MSProject.ViewApply Name:="Gantt Chart"
MsgBox "Project successfully imported."
End Sub</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Run the script.
When it executes the "MSProject.ConsolidateProjects" line of code, this will import the project you created earlier into the new blank project. A dialog will appear letting you know that the task's start date (which is January 1, 2004) is before the new blank project's start date (which is today by default). Until this dialog goes away, TestPartner is frozen and if you just sit there and wait, you'll get a "Server Busy" error within about 10 seconds. There is nothing you can do in this script that I know of to make the dialog go away. OK, if you are watching it and want to hit enter yourself, that will work, but defeats the point of the automated script...
Anyone know what to do to automatically handle this? You cannot put code to type Return, because it will not get executed while the program is frozen. Running another instance of TestPartner from the command line will also not work, because of the server busy error.
Current AUT running test scripts on TP 6.3 build 183, SQL 2000 DB.
Legacy AUT running on TP 5.6.0 Build 81 and TP 6.2 build 449 with SQL 2000 DB.
TP/IE Clients on VMWare ESX 4.1 server, AUT Servers on VMWare ESX 3.5 server.
Application Under Test (AUT):
Client/Server based, IE 7/8 interface with SQL 2005/2008 DB.
Automating with TP since August 2004.
Re: How do you clear a message from Microsoft Project when TestPartner is frozen
I wouldn't really say that TP is frozen, more like it is trying to deal with a COM object that is currenlty busy because of an application modal dialog. If there is no way to handle this through the COM object you may be able to send a Windows API call to select the appropriate button on the dialog.
I am sorry that I dont have more time to look at the problem in depth, but you will most likely need to first aquire the window handle, which you should be able to do with the window you are using to attach. You then should be able to get the button, can't exactly remember the API for this but you may be able to use getDlgItem. Once you have the button you should be able to use SendMessage with it's click constant to click the button.
If I get a chance I will try to take a look in more depth. Good Luck.