简体   繁体   中英

How can I testing the Message Dialog/Box from SWT(with SWTBot)?

Is the message box native SWT? I ask, because SWTBot can't handle native SWT dialogs like message boxes or file dialogs.
Suggestion: work in your application code with (JFace) MessageDialog.openInformation(....) and not nativ SWT dialogs. This works fine with SWTBot.<

I can with MessageDialog.openInformation(....) create a MessageDialog, but I will testing what happens when I click "Yes" or "No". I tried to interpreted the "Yes" and "No" Buttons in der MessageDialog as Buttons.

okButton = bot.button("Yes");

However I get a "org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException: Could not find widget."

Who I can test it?

You cannot test the native dialog with SWTBot.

Reference: SWTBot Wiki

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM