Automatially opening PuTTY sessions with PuttyCM

A while ago I posted a script to automatically open a series of PuTTY sessions. What I didn't know at that time is that several tools exist to achieve the same result. One of these tools is PuttyCM.

Putty Connection Manager (PuttyCM) is a tool that lets you easily open several PuTTY sessions, logon to them and execute post-login commands. Nowadays I use PuttyCM on a daily basis to stream the content of logfiles on linux servers to my local windows machine.
I then use Hoo Wintail to easily filter and highlight specific log file entries. Read more about that in the Hoo Wintail log monitoring article.

PuTTYCM features

A PuttyCM connection is able to logon automatically to an existing PuTTY session. Redefining the connection details in PuttyCM is not needed.
PuttyCM connections

Every PuttyCM connection can have up to 5 post-login commands. This means that PuttyCM opens the PuTTY session, logs on with the specified username and password, and executes the list of commands.
PuttyCM post-login commands

PuttyCM connections can be stored in a database. It's possible to have the database file encrypted too.
PuttyCM database creation

FAQ on PuttyCM

I encountered some problems when using PuttyCM. Here's a list of the problems and solutions:

Q1: When minimizing PuttyCM, the windows remains minimized/on the background and I'm not able to display the PuttyCM window anymore.
  • On the options screen, in the 'General' section, uncheck the 'Hide when minimized' checkbox.
    PuttyCM general options
Q2: After having updated the PuttyCM configuration in the options screen, some changes did not have effect.
  • Click the 'apply' button before clicking the 'ok' button on the options screen.
Q3: When opening a PuttyCM connection, the connection window remains empty and an external PuTTY session window is created which is not attached to PuttyCM on the options screen
  • In the 'PuTTY' section, check the 'Enable additional timing for PuTTY capture(s)' option, and set a value of 2000.
    PuttyCM PuTTY options

Continue reading

How to define good locators for GUI elements

One of the important pillars of a successful test automation project is the robustness of your code. If the GUI of the application under test changes and your automation code is sensitive to GUI changes, you'll lose valuable time fixing the code. Good element locators greatly contribute to the maintainability of your automation project. But what is a 'good' element locator?

A good element locator:
  • is as precise as possible to indicate the GUI element
  • will continue working when GUI elements around the GUI element change
  • will continue working when properties of the GUI element change

Let's have a closer look at these statements and show some examples.

A GUI element locator should be as precise as possible


In a perfect world, each webelement has an html id. Finding an element by html id is the most precise way to define an element, since the id is usually the property that's less likely to change.

For the following html code:
This could be the element locator in Selenium Webdriver:
By.id("createCustomer")
By.xpath("//div[@id='createCustomerButton']")
By.xpath("//*[@id='createCustomerButton']")

Sometimes elements have an html id which is partially fixed. The html contains contains both a fixed and variable part, for instance the timestamp of the build. In the following example, we search for the fixed part of the html id by using the xpath contains function.

For the following code:
This could be the element locator in Selenium Webdriver:
By.xpath("//div[contains(@id, 'createCustomerButton')]")

A GUI element locator should survive changes to its parents


If the element has no html id, we must find other ways to locate the element. You might be tempted to try the 'copy Xpath' action in the developer tools of your browser. This is only a good idea if the source contains html id's, if not, you might get something like:
/html/body/div/div/div/div/div/div[2]/div/div/div/div/div[2]/div/span

It's obvious that this is a bad element locator. If 1 element is added to or removed from this html tree the element locator stops working, or worse, returns a different element.

In order to avoid specifying the complete html tree, you should look for anchor points as close as possible to your element.

Let's have a look at the following html code:
 
Imagine that you need to find the div having the 'button' role in the active menu item. We cannot search directly for the div with the button role, since 2 such divs exist. Instead we need to first find the active menu item and then descend to the div with the button role.

Both are valid element locator implementations in Selenium Webdriver:
By.xpath("//div[contains(@class, 'menu-item-active')]/div/div")
By.xpath("//div[contains(@class, 'menu-item-active')]//div[@role='button']")

A GUI element locator should survive changes to its own properties


If an element has several properties, there's no need to check for all properties. Similarly, if a property (or for instance an attribute in html) has multiple values, you don't need to check for all properties.

Let's have a look at the following code:
    
If you need to get the active menu item, you need to search for the "menu-item-active" value of the class attribute. There's no need to check for the "menu-item" and "accordeon" values in this attribute. Moreover, checking for these additional attributes would make the code brittle. If one of these irrelevant properties changes, the element locator will stop working.

So instead of using this element locator:
By.xpath("//div/[@class='menu-item menu-item-active accordeon']")
You better use the xpath contains function and check only for the relevant attribute value:
By.xpath("//div/[contains(@class, 'menu-item-active')]")

Continue reading

Selecting an item from a Vaadin dropdown with Selenium Webdriver


When we need to select items in a dropdown with Selenium Webdriver, we usually use the Select class. We can then call the selectByVisibleText, selectByIndex and selectByValue methods. Unfortunately this won't work in Vaadin applications. That's because Vaadin doesn't use the select html element, instead it uses it's own implementation.

In order to easily automate the specific Vaadin objects, you could use Vaadin TestBench which is a tool built on Selenium2 but it's not free. As an alternative you could write methods to access the Vaadin specific objects yourself, which is what I did.

Below you'll find the code I use to select an item in a Vaadin dropdown, either by visible text (value) or by index. Both methods start by calling the getMenuItemsFromFilter method that gets the available dropdown items by clicking on the filter arrow next to the dropdown. From each combobox item the WebElement is taken and added to the List which is returned.


Both methods take a 'filterParentLocator' of type By as input parameter. Here you should pass a By object which refers to the div with role 'combobox', which is the parent of both the combobox textfield v-filterselect-input and combobox dropdown arrow v-filterselect-button. The By object could be something like: By.xpath(//div[@role='combobox']).

The first method sets the dropdown value according to the item to search for, specified as an input parameter. It loops through the available choices and when it finds a menu item containing the search text, selects it.
protected void selectItemFromFilter(By filterParentLocator, String searchItem) throws DataNotFoundException {
logger.debug("about to select item from filter, searching for item: " + searchItem);

List menuItems = getMenuItemsFromFilter(filterParentLocator);

WebElement menuItemToSelect = null;
for (WebElement menuItem : menuItems) {
if (menuItem.getText().contains(searchItem)) {
menuItemToSelect = menuItem;
break;
}
}

if (menuItemToSelect == null) {
throw new DataNotFoundException("Couldn't find menu item with text: " + searchItem);
}

logger.debug("selecting folowing item from the filter: " + menuItemToSelect.getText());
menuItemToSelect.click();

}

This method sets the dropdown value according to the index, specified as input parameter.
protected void selectItemFromFilter(By filterParentLocator, Integer index) throws DataNotFoundException {
logger.debug("about to select item from filter, index: " + index);

List menuItems = getMenuItemsFromFilter(filterParentLocator);

try {
WebElement menuItem = menuItems.get(index);
logger.debug("selecting folowing item from the filter with index: " + index + " -> and text: " + menuItem.getText());
menuItem.click();

} catch (IndexOutOfBoundsException e) {
throw new DataNotFoundException("Couldn't find menu item with index: " + index);
}

}

This method returns a list of WebElements where each WebElement in the returned list is a row in the dropdown menu that appears after clicking the filter arrow. The 2 previous methods need this method.
private List getMenuItemsFromFilter(By filterParentLocator) {
By suggestMenuDropdownButtonLocator = By.xpath("//div[contains(@class, 'v-filterselect-button')]");
By suggestMenuLocator = By.xpath("//div[contains(@class, 'v-filterselect-suggestmenu')]");
By menuItemLocator = By.xpath("//td[contains(@class, 'gwt-MenuItem')]");

WebElement suggestMenuDropDown = getDriver().findElement(filterParentLocator).findElement(suggestMenuDropdownButtonLocator);

suggestMenuDropDown.click();

return getDriver().findElement((suggestMenuLocator).findElements(menuItemLocator));
}

Note: I found out that this approach doesn't support dropdowns where 'previous' and 'next' buttons are displayed in order to browse through the dropdown items. If you need to support such case, you'll have to take another approach.
Continue reading

Waiting for a page to be loaded (synchronizing) with Selenium Webdriver

An often reoccuring automation problem is the synchronization of web pages. The automation script should only continue if the page is fully loaded. If the automation code tries to continue before the page is fully loaded, some objects might not be visible yet and the script will fail.
In some web development frameworks a loading indicator is used to show that a page is being loaded. The presence of this loading indicator object can be used to determine whether the page is still loading.

How can we implement this in Webdriver? Webdriver has a built-in method to check if an element is visible or not: ExpectedConditions.visibilityOfElementLocated(). We could use this method in combination with the WebDriverWait object in order to wait until the loading indicator is not visible, for instance:
private void waitUntilPageStopsLoading(int timeout) {
By loadingIndicatorLocator = By.xpath("//div[contains(@class,'v-loading-indicator')][contains(@style, 'display: block;')]");
WebDriver driver = getDriver();
WebDriverWait wait = new WebDriverWait(driver, timeout);
wait.until(ExpectedConditions.invisibilityOfElementLocated(loadingIndicatorLocator));
}
However, this approach will not work all the time. Imagine that the application starts loading with a short delay. If the WebDriverWait checks for the presence of the loading indicator before the loading indicator is shown, the script will conclude that loading has finished and will continue, even before the actual loading has started.

Therefore I prefer to first check if the page starts loading, with a timeout of 1 second for instance. This way we'll wait for maximum 1 second for the loading to start. If the loading indicator is still not shown after 1 second, we can be quite sure that the page will not start loading anymore, else we wait until the loading has finished.
Here's a complete example:
public void sync() {
sync(60);
}

public void sync(int checkStopSyncTimeout) {
sync(1, checkStopSyncTimeout);
}

public void sync(int checkStartSyncTimeout, int checkStopSyncTimeout) {

if (pageStartsLoading(checkStartSyncTimeout)) {
waitUntilPageStopsLoading(checkStopSyncTimeout);
}

}

private boolean pageStartsLoading(int timeout) {

WebElement element = null;
try {
By loadingIndicatorLocator = By.xpath("//div[contains(@class,'v-loading-indicator')][contains(@style, 'display: block;')]");

WebDriverWait wait = new WebDriverWait(getDriver(), timeout);
element = wait.until(ExpectedConditions.visibilityOfElementLocated(loadingIndicatorLocator));

} catch (TimeoutException e) {
// Do nothing, if the page doesn't start loading, it probably means that the page doesn't have to start loading and is already synchronized (or is really slow :-))
}

return element != null;
}

private void waitUntilPageStopsLoading(int timeout) {
By loadingIndicatorLocator = By.xpath("//div[contains(@class,'v-loading-indicator')][contains(@style, 'display: block;')]");

WebDriver driver = getDriver();
WebDriverWait wait = new WebDriverWait(driver, timeout);
wait.until(ExpectedConditions.invisibilityOfElementLocated(loadingIndicatorLocator));

}

Continue reading

Call for Software Testing Blogs

It has been a while since I composed the Top 100 Software Testing Blogs. To be more precise, it has been 1 year and a half already. Since software testing blogs change and evolve, just like any other thing in life, a new Top 100 Software Testing Blogs would surely make sense. So let's make a 2011 edition!

This time I count on you to make this edition a success. Submit any software testing blog, that's not yet in the original Top 100 Software Testing Blogs, in the comment section of this post. By doing this you increase the coverage of software testing blogs eligible to this list, so we have less chance of missing any. All new submissions and the ones from the original top 100 will be evaluated together to finally become a new Top 100.

Make sure the blog applies to following criteria:
  1. must be software testing related
  2. can have technical test automation/performance topics but should not be about technical test automation/performance only
  3. must be not present yet in the original Top 100
Deadline for submissions: Wednesday 30th of November at 23:59


Your input is much appreciated. Thanks in advance!
Continue reading

Top 100 Software Testing Blogs

Software Testing Blogs Here it is at last: my first Top 100 of Software Testing Blogs. For those who would like to read more on Software Testing and QA, I created a list with 100 of the best - or at least most popular - Software Testing Blogs in the world. This should definitely give you enough reading!

I ordered this list by gathering several metrics of each blog, to be more precise: the Google Pagerank, Alexa Popularity, Technorati Authority, number of comments and number of sites linking to it.(Note: Not all statistics were available for each blog. Where a statistic was missing, the blog in question simply scored 'neutral' for that statistic). You can read the algorythm I used to rank the blogs at noop.nl. Many of the results were gathered automatically using my Pagerank Checking script.

Enjoy the list and please let me know which blogs I forgot!


#SiteAuthor
1James Bach's BlogJames Bach
2Testing at the Edge of ChaosMatt Heusser
3Agile Testing Grig Gheorghiu
4Martinfowler.comMartin Fowler
5Tester Tested!Pradeep Soundararajan
6Testing BlogGoogle Testing
7Cem Kaner’s BlogCem Kaner
8Miško HeveryMiško Hevery
9DevelopSenseMichael Bolton
10Sara Ford's WeblogSara Ford
11Steve Rowe's BlogSteve Rowe
12Test ObsessedElisabeth Hendrickson
13Software Quality Insights( various )
14Exploration Through ExampleBrian Marick
15Gojko AdzicGojko Adzic
16Thinking TesterShrini Kulkarni
17Chris McMahon's BlogChris McMahon
18JW on TestJames Whittaker
19Software testing helpVijay
20Corey Goldberg Corey Goldberg
21Quality FrogBen Simo
22Testing Hotlist UpdateBret Pettichord
23AbakasCatherine Powell
24Collaborative Software TestingJonathan Kohl
25Sbarber's blogScott Barber
26Adam goucherAdam goucher
27Eric JarviEric Jarvi
28Karen N. Johnson's blogKaren N. Johnson
29Test GuideMichael Hunter
30Curious TesterParimala Shankaraiah
31Testy RedheadLanette Creamer
32Antony Marcano's blogAntony Marcano
33All Things QualityJoe Strazzere
34I. M. Testy Bj Rollinson
35Software testing zoneDebasis Pradhan
36PractiTest QA Blog Joel Montvelisky
37Practical QALinda Wilkinson
38Marlena’s BlogMarlena Compton
39Software Testing and moreEwald Roodenrijs, Andréas Prins
40patrickwilsonwelsh.comPatrick Wilson-Welsh
41Quality Assurance and Software Testing( various )
42Testing Testing 1,2,3Chan Chaiyochlarb
43Mike Kelly's blogMike Kelly
44Test this Blog Eric Jacobson
45Enjoy testing Ajay Balamurugadas
46Evil TesterAlan Richardson
47Tooth of the WeaselAlan Page
48Charlie Audritsh's blogCharlie Audritsh
49Maverick Tester Anne-Marie Charrett
50Paul Gerrard's blog Paul Gerrard
51shino.deMarkus Gaertner
52Cartoon TesterAndy Glover
53cLabs BlogkiChris Morris
54Jeff Fry on TestingJeff Fry
55Venkat's BlogVenkat Reddy Chintalapudi
56Agile Testing and Process ThoughtsJanet Gregory
57Software Testing Stuff( various )
58selenadelesie.comSelena Delesie
59Software SleuthingJosh Poley
60The Software Quality Blog Vijay Bhaskar
61Expected ResultsPhil Kirkham
62One of the wolvesTim Coulter
63Musing about Software TestingKeith Stobie
64Jon Bach's blogJonathan Bach
65Quardev( various )
66Software Testing Club Blog( various )
67TestToTesterSharath Byregowda
68Agile Testing with Lisa CrispinLisa Crispin
69Confessions of a Passionate TesterDawn Cannan
70I am filled with solutionsDustin Andrews
71Software TastingGeordie Keitt
72Rosie LandRosie Sherry
73Still LifeSteve Swanson
74Brian OsmanBrian Osman
75Dhanasekar S’s BlogDhanasekar S
76The Social Tester Rob Lambert
77QA InsightBrent Strange
78The Testing Blog( various )
79TestingmindedSteven Machtelinckx
80John McConda's blogJohn McConda
81Software TestingLen DiMaggio
82Jeroen's world of Software TestingJeroen Rosink
83TestingPerspectiveRahul Verma
84Adam White Adam White
85Purple Box TestingTrish Khoo
86Lessons Learned by a Software TesterPaul Carvalho
87Pliant AllianceTim Beck
88TestjutsuBen Kelly
89IlliterationJared Quinert
90Tester TestifiesRaj Kamal
91Santhosh Tuppad's BlogSanthosh Tuppad
92TeknologikaBruce McLeod
93Creative TesterAnuj Magazine
94Tester Troubles Ray Claridge
95Thoughts on QA and EngineeringJohn Overbaugh
96Quick Testing Tips( various )
97Cruisin QABrett Leonard
98QA Hates YouThe Director
99Tester Lost FocusMichelle Smith
100James McCaffrey's blogJames McCaffrey

Edit: Meanwhile some kind people have submitted blogs which I did not take into account when I created this list. They will be included in future updates.

Test Side Story from Zeger van Hese would have been number 70.
Quality Perspectives from Lynn McKee would have been number 107.
Unimagined Testing from Nancy Kelln would have been number 90.
Software Testing Genius from Yogindernath would have been number 66.
Rob Kuijt's Testing Blog from Rob Kuijt would have been number 51.
Continue reading

Running JMeter tests from behind a proxy server

Sometimes you may need to create and run your tests from behind a proxy server / firewall. For instance when you're on the LAN / intranet and need to connect to the outside. This is very easy to do so, but it can be hard to find out for the first time.

Configuring the proxy server

You need to launch JMeter with one or more of the following options:
-H [proxy server or IP address]
-P [proxy server port]
-u [username for the proxy authentication]
-a [password for the proxy authentication]
Examples:

  • jmeter.bat -H 192.168.10.1 -P 8012
  • jmeter.bat -H 192.168.10.1 -P 8012 -u my_user_name -a my_password
The easiest way is to create a new .bat file which launches jmeter.bat with the options above and place it in the JMeter bin directory. This way you can easily switch between JMeter and JMeter with proxy, without having to enter the settings again. Download an example bat file with proxy here.

Note: This proxy mechanism is different from the built-in Http proxy server. The http proxy server can be used to record http browser sessions and requires you to modify set the browser proxy settings.

Testing the proxy server settings

There are several ways to check if the proxy server settings are correct. I prefer to connect to a public webservice as it is very easy to do so, e.g. the one from amazon: http://soap.amazon.com/schemas3/AmazonWebServices.wsdl. Create a WebService(SOAP) request, fill out the WSDL url and click the "Load WSDL" button. The "Web Methods" dropdown gets filled with the available webservice methods. Congratulations, you correctly set the proxy server settings as you managed to reach the public webservice. Download the JMeter webservice request test file here.

You don't get the the list of methods, instead you get an exception message? Check if  you get one of these messages:

Error1: The WSDL was not valid, please double check the url. org.apache.jmeter.protocol.http.util.WSDLException: Connection timed out: connect.

  • The proxy server settings are probably incorrect, double check the proxy server and proxy server port
Error2: The WSDL was not valid, please double check the url. org.apache.jmeter.protocol.http.util.WSDLException: Server redirected too many times(20)

  • The username and password are probably incorrect, double check the correctness of these data
Error3: The WSDL was not valid, please double check the url. org.apache.jmeter.protocol.http.util.WSDLException: http://soap.amazo.com/schemas3/AmazonWebServices.wsdl


  • The webservice is probably not up, or you made a typo like I did in the url above: amazo instead of amazon. Paste the url in a browser and check if you get an xml-like file describing the webservice.

Did you get get an other message? Leave a comment and I'll come back to you.
Continue reading

Top 5 Reasons to choose Watir

Watir stands for "Web Application Testing in Ruby". It is a library in Ruby which allows you to automate web applications. By default Watir supports IE, but with support of supplementary libraries you're able to automate applications in Firefox, Chrome and Safari as well.

Sometimes I need to automate a task in a webbrowser. There are many tools on the market to choose from but so far Watir is my preferred one. These are my main reasons to choose for Watir:

  1. It's free! It's an open source tool, so there are no costs to use this tool.
  2. It supports multiple browsers and platforms.
  3. It uses Ruby, my favorite scripting language. Ruby is concise and a joy to read and write.
  4. The Ruby knowledge gained when using Watir can leverage my Ruby and Ruby on Rails projects, and vice versa.
  5. It's lightweight. My computer doesn't suffer when creating or running automated tests.

Have you got any particular reasons to choose or not to choose Watir?
Continue reading

Agile Testing with HP Quality Center Agile Accelerator

Companies are increasingly turning towards alternative development management strategies to manage complex and emerging technologies. Projects are increasingly reviewing and adopting Agile methodology as the de facto standard to manage their application development environments for a variety of reasons. The important reasons amongst these are to reduce total cost of ownership, increase quality and reduce time to market.

What is Agile testing?

Agile testing is a software testing practice that follows the principles of the agile manifesto, emphasizing testing from the perspective of customers who will utilize the system. Agile testing does not emphasize rigidly defined testing procedures, but rather focuses on testing iteratively against newly developed code until quality is achieved from an end customer's perspective. In other words, the emphasis is shifted from "testers as quality police" to something more like "entire project team working toward demonstrable quality."

Agile testing involves testing from the customer perspective as early as possible, testing early and often as code becomes available and stable enough from module/unit level testing.

Since working increments of the software are released often in agile software development, there is also a need to test often. This is commonly done by using automated acceptance testing to minimize the amount of manual labour involved. Doing only manual testing in agile development may result in either buggy software or slipping schedules because it may not be possible to test the entire build manually before each release.

HP Quality Center Agile Accelerator

The HP Quality Center Agile Accelerator is designed to help projects manage Agile development using HP Quality Center 10.0. It can be imported into HP Quality Center 10.0 as a base project to manage both development and testing efforts within the same HP Quality Center Project. It comes with pre-built Agile user roles and related privileges, pre-defined Agile process workflows, configurations and rules to help you manage projects driven by Agile methodology. It also facilitates Agile reporting allowing you to track progress burn-down, burn-up and velocity.

Agile Accelerator Benefits

  • Supports multiple Agile practices including Scrum/XP methodology: Sprint, Backlog, User story
  • Reduces calculation effort including tasks, estimation, planning, and spent hours
  • Improves information visibility across all user groups such as product managers, project engineers, Scrum Master, and others.
  • Encompasses the full project lifecycle from planning to delivery, development and testing ensuring application meets promised requirements
  • Reports project progress and delivered value through Burn-up charts and Burn-down charts
Continue reading

Recent Articles

Top Commenters

Recent Comments