Hi, I would rather not mess with jacob and other Java-COM bridges.
Here is a simpler approach: We can't call COM directly from Java but we can write a simple VBA to automate testing and run it using Runtime.exec. Consider an example. Create a simple VBA script and save it in vbtest.vbs. Set pptApp = CreateObject("PowerPoint.Application") Set ppt = pptApp.Presentations.Add ppt.SaveAs "D:\temp\vba.ppt" ppt.Close Set ppt = Nothing pptApp.Quit Set pptApp = Nothing Run the script in java: Runtime.getRuntime().exec("cscript vbtest.vbs"); Of course you need to read stoud and stderr to see what's happening but I think you have the idea. I checked and it does work on Windows. Does anybody know if OpenOffice for Linux and Office for MAC can be automated in this way? I think they should but can't check it. The problem is how to watch the results. I'm not sure we can create 100% automated VBA framework for testing. Normally the VB script interpreter prints messages in stdout and stderr. In case of fatal errors the application window (Word, PowerPoint or Excel) can stay alive and you have to manually kill it. If I have time I will post a real VBA test case a bit later. Regards, Yegor KOzlov RS> Hi, RS> I'm thinking about how to "semi automate" testing of doc files which RS> were created by HWPF. I'll explain what runs through my mind and RS> would like to know, if anybody has an opinion on that and which tools RS> would be ok or not. RS> The first thing which came to my mind is using jacob (java COM RS> bridge) in a Windows environment to let Winword open and save a test RS> file. If the process doing that is still active after a certain time, RS> the test is declared as failed and the Winword instance is killed. RS> I'm not into COM programming and I'm not sure how much it takes to do RS> it that way, but I'm trying. RS> I would prefer a jacob based solution. But if for any reason jacob is RS> not suitable, I would bet that such a thing can be created simply RS> without using Java. It should at least be possible to run two RS> programs and let one do the COM stuff and the other watch it. If the RS> test program hangs, the watch program could find running instances of RS> winword and the test program and kill them - hopefully not leaving RS> too many resources hanging around after that. RS> Such kind of tests obviously run on Windows only (don't want to think RS> about remote access to a Windows machine which runs the tests and RS> returns the results) so its not part of the unit tests. With a few RS> dozen test cases (= generated Word files) it feels bad to open those RS> files manually and check that they are working. (Personally I can RS> feel my mood go down drastically when looking at 30 tick boxes on a RS> sheet of paper representing really ugly work...) RS> Apart from simple crashes/crashes-not testing this could be extended RS> to a test tool checking for instance whether the bold formatting RS> created in HWPF is really bold when asking Winword. But thats surely RS> something to discuss after the crashes/crashes-not part is done. RS> Now the questions: RS> Are there any objections against such a tool in general? (besides RS> from "only runs on Windows" :-) ) RS> Is there a better approach for that? RS> Should jacob not be suitable, which "development environment" would RS> be recommended? RS> (VC8Express, Watcom, gcc(?); don't know yet whether one needs the RS> Platform SDK for that or not...) RS> Best wishes, RS> Rainer RS> (He who is tired of the open-save-cycle and RS> occasionally-killing-Winword-instances :-) ) RS> --------------------------------------------------------------------- RS> To unsubscribe, e-mail: [EMAIL PROTECTED] RS> Mailing List: http://jakarta.apache.org/site/mail2.html#poi RS> The Apache Jakarta POI Project: http://jakarta.apache.org/poi/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/