Monday, January 23, 2012

Add comments using VIM editor

Very Useful VIM editor trick ,,,,,,,,,,,,,,,,

To add comments easily to any code

First Press Ctrl+v to start the visual mode from a particular location then select the needed characters using arrow button

Second Press I to enter into a special insert mode to input characters like '//' and Press Esc.

Now the inserted character will appear in all the selected lines.

To remove this first character again select the needed characters and Press 'd' to remove it.

Another form to add words at the end of each selected lines Press 'A' append, then add words and press Esc

If we press $ the whole line will be selected.

Some more short-cut keys in command mode(Press Esc).
yy - copy
p - paste
d - to cut

Friday, January 6, 2012

GUI Testing using UISpec4J api

I would like to share some information regarding how to use UISpec4J for GUI Testing. This post will be edited with more information as soon as I gain experience in that.

First we have to create a setup method like this inside the subclass we extended from UISpecTestCase

protected void setUp() throws Exception {


setAdapter(new MainClassAdapter(YOURMAINCLASS.class));

Window window = getMainWindow();

// Get references to UI elements 


While getting references to other elements, we have to make sure that it is easily accessible to UISpec4J. For that developers, should use setName() method for the UI elements like button, text box, panel, etc .......

If the element is not directly accessible (ie. nested inside many panels). We have to use the panel1 = window.getPanel("PANELNAME") method to get a reference.

So using the panel2 = panel1.getPanel("PANELNAME") method we can easily
go to the particular panel in the application window.

Note :- Before making assertions we have to call the UISpec4J.setAssertionTimeLimit(int ms) to give a delay before starting the assertion.

To intercept a modal dialog box, we have to use like this,
.process(new WindowHandler("Main Window") {
public Trigger process(Window window) {
// Now you can use the window to access the elements in the modal dialog box
return window.getButton("OK").triggerClick();

If anything wrong, inform me. :)