Skip to main content



      Home
Home » Eclipse Projects » SWTBot » Find custom View with bot
Find custom View with bot [message #1845043] Mon, 04 October 2021 08:54 Go to next message
Eclipse UserFriend
Hi,
We have custom class extended from org.eclipse.jface.viewers.TreeWiewer and we need to test it. How can I get this widget with SWTBot? I tried this way:
 Display.getDefault().asyncExec(() -> {
           CustomTreeViewer customTreeViewer = bot.widget(WidgetMatcherFactory.widgetOfType(CustomTreeViewer.class));
            
        });

but "CustomTreeViewer.class" is underlined in red and the message says
Quote:

Required type:Class<T>
Provided: Class<PropertyTreeViewer>
reason: no instance(s) of type variable(s) exist so that PropertyTreeViewer conforms to Widget

So the question is there any opportunity to do this with bot?
Thanks in advance!
Re: Find custom View with bot [message #1845053 is a reply to message #1845043] Mon, 04 October 2021 16:23 Go to previous message
Eclipse UserFriend
Hi Дарья,

This is failing because a TreeViewer is not a Widget. As far as I know it is not possible to access the TreeViewer from SWTBot.

You can however access the Tree that is returned by TreeViewer.getTree() using SWTBotTree.

If you have no other choice, you might be able to get a reference to the CustomTreeViewer for tests by storing it inside the Tree's data within your application, using setData()/getData() perhaps with a key. It's a bit hackish though.

Patrick

Previous Topic:test rcp application
Next Topic:How to test the Workspace launcher dialog
Goto Forum:
  


Current Time: Thu May 15 13:18:29 EDT 2025

Powered by FUDForum. Page generated in 0.25177 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top