• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JUnit: recognise that a MessageBox pops up

 
Steffen Mezger
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

i have to test a function which opens a Messagebox at the end of the code. And because that the Junit test will stop until anybody clicks "OK" on the messagebox. Thats not good, because nobody is near the PC during the test...

How can i solve this problem ? Are there any possibilities to close that box automaticly or terminate the new window ??

Thanks !

Best regards,
Steffen
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are at least two solutions:

- use an extension to JUnit, such as Jemmy, to actually check that the box is there, and to click the close button, or

- introduce an indirection, so that you can mock the method call that opens the message box
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic