Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Find custom View with bot
Find custom View with bot [message #1845043] Mon, 04 October 2021 12:54 Go to next message
Дарья Федорова is currently offline Дарья ФедороваFriend
Messages: 6
Registered: May 2021
Junior Member
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 20:23 Go to previous message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
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: Mon Feb 26 02:43:23 GMT 2024

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

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

Back to the top