Showing posts with label Automated UI Testing. Show all posts
Showing posts with label Automated UI Testing. Show all posts

Wednesday, April 14, 2010

Using Tab Window Manager with VNC in Automatic UI testing

By default Ubuntu 9.10 - the Karmic Koala - using twm windows manager for displays created by vncserver command. But twm with default configuration requests user to select new window location by mouse and waited until that happened. It is real problem when you're trying to run UI tests and UI applications are started by build script. With default twm settings your testing session just hangs at point of creating window and you have to open display where your tests are running and make that damn click to keep your tests rolling it is Ok if you have one window and long running tests, but it is not working if your UI application starts many times during testing.

twm window manager allows to control this behavior by RandomPlacement variable in $HOME/.twmrc configuration file. To let your tests go without your attention just add line.

RandomPlacement

in your existing .twmrc file or create new one see [1] for other configuration parameters.

If that doesn't work you probably do not have twm installed by default, I faced that problem. It looked like everything is fine but I had no title bars for windows opened in vnc session. To fix that just install twn window manager using your favorite way to do it. I did it by

sudo apt-get install twm

After restarting vncserver everything is working like a charm.

[1] - Tab Window Manager Manual - http://www.x.org/archive/X11R6.8.0/doc/twm.1.html

Thursday, April 1, 2010

Run Eclipse UI Test Plug-in without Eclipse Workbench Window Bothering You

In Test Driven Development it happens you need to run Eclipse UI Tests and keep working at the same time. You can start tests but then you'll get Eclipse Workbench window annoying you especially if you have several JUnit Test Suites to run. Eclipse Workbench Window will pop up and grab input focus for each new suite and that's really annoying. After fiddling with my linux I found several ways to solve this issue:
  1. Do not run tests at all, which is not acceptable for TDD;
  2. Run only Eclipse core tests without workbench window, which is not enough to make tests results reliable;
  3. Create new display and force test session to use it.
Firs option isn't reasonable at all. Second is good enough for non UI applications, but has no value for opposite ones. Third is not for none UI applications, but is the best for UI ones. Fortunately, it is amazingly easy to create new display and redirect your tests execution to it. You have couple options to consider for creating new display :
  1. start vncserver
  2. create virtual buffer using Xvfb
After you have created new display just pass display number as local environment variable in your command line like DISPLAY=:N ${your-command-line-here} and you'll never see your eclipse workbench window :) But if you need to follow tests for a while or just check what is going on from time to time you can use vncviewer or xwud for first or second option accordingly.