0

I'm trying to test existing software and I'm running into an issue; if, during a junit test suite, I close a gui window, the whole test suite just ends. No errors, failures, or successes. It definitely ends too, because it closes all other windows as well, and terminates the thread.

I'm not using junit to the test the GUI - that's more of a system test obviously, and I'm using GUI automation software for that. However, in order to test a method in one of the classes in the software, I have to have stuff going on with the gui. At the end of the tests, I need to close the windows or they will remain open and will actually interfere with the other tests (it's networked software). However, as said, sending an onclosing event to any window immediately ends the test suite.

I became curious about the whole thing and slowly came to realize, to my horror, that even in normal execution, if I close a window, it's not handled within the software, it just magically stops executing! The main driver's loop doesn't even have any exit condition whatsoever, just while(true) with no breaks! My thinking is this must be related to why everything just stops when I close a window during the tests.

Anyways, I still don't fully understand what's happening, so if someone could fill me in, that would be great. But my main question is how can I fix/ get around this issue and close windows without killing the whole test suite.

Note: I can't change the behavior of the software. (As you may have guessed, this is for a class)

user2345397
  • 301
  • 1
  • 11
  • It is so hard to read paragraphs of information without any code. Usually I just look at the code. My vocabulary is limited mainly to: if,then,else,for,break,&&,continue. – CodeCamper Apr 17 '14 at 17:16

1 Answers1

0

Sounds like the window close is calling System.exit(). If you have the ability to remove that, you could do so. If you don't, you could install a SecurityManager that prevents the call during testing. Example here: Preventing System.exit() from API

Community
  • 1
  • 1
Rob Eden
  • 362
  • 2
  • 7