Why is a menu item disabled when using SWTBot?

Posted by reprogrammer on Stack Overflow See other posts from Stack Overflow or by reprogrammer
Published on 2010-09-14T05:01:05Z Indexed on 2011/01/04 20:53 UTC
Read the original article Hit count: 268

Filed under:
|
|
|
|

I've written up a GUI test using SWTBot to test the Extract Method refactoring. I use editor.selectRange() to select a statement to extract into a method. But, when I run the unit test, the Extract Method refactoring menu item is disabled. Thus, SWTBot fails to invoke the refactoring.

When we change org.eclipse.jdt.ui.actions.ExtractMethodAction so that the "Extract Method..." menu item is always enabled, our SWTBot passes. But, SWTBot should let us select the menu item without hacking the org.eclipse.jdt.ui plugin.

The whole project containing the above unit test is available at github. I've also reported the problem on the Eclipse forum for SWTBot. But, we haven't received a solution from the forum.

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about unit-testing