how to clean the "Error Log" view?

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

how to clean the "Error Log" view?

Postby JLomin » Fri Mar 30, 2007 4:27 am

Does somebody knows how to clean the "Error Log" view?

I want to simulate the click in the "Delete Log" button using the new ContributedToolItemLocator class, but the problem is that I dont know how is called the action associated to the "Confirm Delete" action.

For example, this opens the Eclipse Search Dialog by clicking the toolitem associated with the "" action id:
Code: Select all ContributedToolItemLocator(""));
Posts: 11
Joined: Mon Feb 05, 2007 11:40 pm

Postby Phil Quitslund » Fri Mar 30, 2007 8:44 am

Hmmm... After a little poking around, it looks like that action is not contributed and so that locator won't do the trick. We'll have to cook up another way to find that item!

In the meantime, maybe a right click will do the trick?

Code: Select all
import junit.extensions.UITestCaseSWT;

import com.windowtester.runtime.IUIContext;
import com.windowtester.runtime.locator.IWidgetLocator;
import com.windowtester.runtime.swt.locator.ButtonLocator;
import com.windowtester.runtime.swt.locator.MenuItemLocator;
import com.windowtester.runtime.swt.locator.TreeItemLocator;
import com.windowtester.runtime.swt.locator.eclipse.ViewLocator;

* Snippet to delete error log entries using the error log item context menu.
* @author Phil Quitslund
public class DeleteErrorLog extends UITestCaseSWT {

   public void testDeleteErrorLogWithContextClick() throws Exception {
      IUIContext ui = getUI();
      //bring up the error log MenuItemLocator("&Window/Show &View/Error Log"));
      //perhaps wait here? <-- need a condition for view showing!
      //get all the tree items
      IWidgetLocator[] items = ui.findAll(new TreeItemLocator("*", new ViewLocator("org.eclipse.pde.runtime.LogView")));
      //if the log is not empty, clear it:
      if (items.length > 0) {
         ui.contextClick(items[0], "&Delete Log");
         ui.wait(new ShellShowingCondition("Confirm Delete")); ButtonLocator("OK"));
         ui.wait(new ShellDisposedCondition("Confirm Delete"));


Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest