how to kill java programme?

46 views
Skip to first unread message

franz

unread,
Sep 7, 2009, 5:04:53 AM9/7/09
to robotframework-users
hi
i'm using swing library to test some big java applications. I wrote
the keyword to shut it down, but it didn't work every time, because it
use File|Exit from main menu and sometimes some dialogs are shown
during exiting when some errors occur and I cannot predict all
possible dialogs. Since the point of my work is to execute test during
night I need a way to be sure that application is closed and that only
one instance of my application will be running during test. So my
question is how to "pull the plug" and be sure that after test was
executed the application would be closed

Thomas Klein

unread,
Sep 7, 2009, 5:16:50 AM9/7/09
to robotframework-users
Hi,

I'm not familiar with the swing library, but it looks like there is no
build in mechanism to kill the java application under test. What I
would suggest to the swing library developers (or maybe you can do it
and submit a patch) is the following:

- make Launch Application / Start Application keywords return the
process ID of the app.
- add a keyword "Kill Application | ${pid}" that uses kill/taskkill os
commands to kill the process

Maybe you can add a feature request if you don't want to do it
yourself.


Cheers,

Thomas.

Heikki Hulkko

unread,
Sep 7, 2009, 5:23:13 AM9/7/09
to maciej....@gmail.com, robotframework-users
Hello,

On Mon, Sep 7, 2009 at 12:04 PM, franz<maciej....@gmail.com> wrote:
> one instance of my application will be running during test. So my
> question is how to "pull the plug" and be sure that after test was
> executed the application would be closed

Killing the jvm is not a good option if your application runs in the
same virtual machine as the Robot. It will close Robot abruptly and no
logs will be generated. In your case I would recommend trying the new
"Close All Dialogs" keyword [1].

The other option is to use ApplicationLauncher [2] which starts your
SUT in a separate jvm and contains "Close Application" keyword. I
don't recommend using ApplicationLauncher though if it is not
absolutely necessary as it will slow down the test execution somewhat
and bring more complexity to your test setup.

[1] http://robotframework-swinglibrary.googlecode.com/svn/tags/swinglibrary-1.0/doc/swinglibrary-1.0-doc.html#Close%20All%20Dialogs
[2] http://code.google.com/p/robotframework-javatools/wiki/ApplicationLauncher


Best regards,

Heikki

franz

unread,
Sep 7, 2009, 6:15:55 AM9/7/09
to robotframework-users
Thanks guys for help. I think I'll start with Close All Dialogs
keyword it seems to be perfect for my situation
Reply all
Reply to author
Forward
0 new messages