Test Automation

The goal is to write at least once a month about topics that relate to my work - Enterprise Agility, Leadership, Entreprenuership, Personal Develop and Africa. My writings represents my opinions and it will change over a period of Time.

Test automation click might not completely simulate an actual human click

I have been working at this client where i am opportuned to use cucumber, watir-webdriver and i came across this problem today. The application i am testing is an e-commerce site and i am writing test for a page on which i click on an item and the item appears on the shopping basket area of the site. My code look like [code] def select_item(item_name) @browser.li(:text => /#{item_name}/).link(:class_name => “addOptions”).click Watir::Wait.

My notes from the selenium conference 2011

I had the opportunity to attend the selenium conference and loads of good stuff, i must tell you. This post is an attempt to highlight the conference talks/ seminar that i really enjoyed. Page Object 101: This was a workshop delivered by Patrick Wilson Welshand Adam Goucher. Even though I have done a lot of page objects in the past, at a glance i like the way patrick has approached html elements, (wraping each html elements in a class), it feels like writing selenium code in a watir way.

A tester's reflection on kanban plus BDD

Having just finished an engagement with a client where the development practices include kanban and BDD. Kanban for us meant that we give priority to work on the right side of the board. So as a tester, I would rather spend my time doing some manual testing on a story that is in the QA queue, than writing automated acceptance tests for a story in the queue for Acceptance Tests.

Workaround: Flash selenium test would not run in firefox 3.5 except when the browser mode is *firefoxProxy

I looked into flash seleniuma few weeks back and i thought it was a great way for me to test certain part of the apps i have been ignoring for some time.However after knocking up a few test i discovered that my test would not run in my version of firefox (3.5). I got this error:INFO - Got result: ERROR: Threw an exception: NPMethod called on non-NPObject wrapped JSObject! on session 471c65508e46457fa43f4deb873d0592Then i read in some issueraised in the flash selenium site that flash selenium would only work in firefox 3.

Search for a single digit within a string using regex as provided in java api

In my current work, i have been writing a lot of test in Java, which obviously means i need to learn a lot more about the Java api, which is good i think?????Well i needed to match the single digit in this string “home-area-1” and return this digit. With a quick google i found this piece of code here.Pattern p = Pattern.compile(“ab”);Matcher m = p.matcher(“aaaaab”);boolean b = m.matches();System.out.println(b);A quick run of this code printed “true” which means the code works.

Start the Selenium Server dynamically

I have been working on a test suite in java using testng as the testing framework. I could not have suggested any other test frame work as it allows me to do a lot of configurable setups and teardowns. Yeah am not gonna promote testng anymore, lol.I could have started using selenium server using a usual batch file that maven could call in one of its targets but i think doing it this way is cleaner.

css selectors in place of xpath for selenium locators

I have always resolved to using xpath whenever i am creating selenium scripts and i need to do locate elements with no ‘id’. Well as you would probably know, xpath executes so slow on IE. For intance i have a test suite that would run in 1hr 30mins on firefox/ safari but the same test suites would take over 4hrs to run to completion on IE.So with the help of a colleagues, i have been using css selectors from last week and i can say this has drastically improved the speed of our test and you would notice too much difference between IE and FF/Safari anymore.

Need to get a value of an attribute using selenium

I was in this situation when i needed to get the value of an html attribute and i found the selenium.getattribute very handy …..Okay the scenario was such that there was an element which is collapsible on the page and the only attibute for that element that indictated the status of the collapsible element was the ‘Class’. when the element was collapsed, the value of the class attribute was ‘asleep’ and when the element was expanded, the value of the class atttribute was ‘awake’.

Internet Explorer doesnt handle xpath to locate images exceptionally well

So i have been doing a lot of selenium and the website i am trying to automate test fordoesnt have a lot of element with id, name, or any other HTML attributes that makes selenium testing a bit easier.So i have been using of xpath, my intent was to click on an image and i have used the src attribute of the image element.so my original command,selenium.click (“xpath=//img[@src="location/of/image/on/disc”]");This works excellently on firefox but on IE, i keep getting the error “Element not found!

Use selenium to create screenshot

I just stunbled across selenium as a tool to take screenshot.Thuis could be useful for anything.In my case i used it to take the screenshot of a page just before it throws an error in my selenium test. and that i could have a look and investigate what the problem might have been.very simple command and the great thing is it can be easily used for screenshots of a page across different browsers.