Each day presents something new to learn.

Apart from Technical Topics, increasingly i find myself wanting to write about other topics that interests me - Entreprenuership and Business, Leadership, Africa, Service Industry (e.g Hotels, Restaurant). My writings would always represent my opinions and it might change from time to time.

Blank cells in step tables in cucumber 0.3.11 is represented as nil

In my current job, I have been doing a lot of acceptance test using Cucumber, Watir and RSpec, obvious all in Ruby. I have been using Cucumber 0.6.x, in which blank cells in the step table are represented by empty string (“”). This was okay for me until today when i had to use a previous version of Cucumber 0.3.11 due to reasons including compatibility with other projects in the CI build.

selenium.open timeouts for strange reasons

Have you ever been in situations when your selenium RC test times out after the selenium.open command, the page is loaded but selenium just tells you that it has timed out after 30000ms. I had same problem in Java today when i got the selenium RC 1.0.3 and i fixed the problem by setting the selenium timeout to be “0”. so i have done @BeforeClass public void setUp(){ selenium = new DefaultSelenium(“localHost”, 4444, “*iexplore”, url);

Regex for pipe "|" character

I was trying to split a string using a regex today and i had this problem my string of format A | B | C My intent was to split this string using the Regex match for “|” The regex that worked for me was “\|” - escaping pipe and then escaping the slash the escapes the pipe

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

I looked into flash selenium a 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!

selenium failed to start browser in iexplore mode when selenium server is started dynamically in code

In a previous post, i have written about how i have been starting/ stoping the selenium server dynamically. What i didnt mention was that i was not able to run my tests using Internet Explorer. I got this error 11:56:55.272 INFO - Command request: getNewBrowserSession[*iexplore, http://localhost:8080, ] on session null 11:56:55.272 INFO - creating new remote session 11:56:55.381 INFO - Allocated session 688eff769c8b4751b5fb9477bba213f3 for http://localhost:8080, launching... 11:56:55.397 ERROR - Failed to start new browser session, shutdown browser and clear all session data java.

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(“a*b”); Matcher m = p.matcher(“aaaaab”); boolean b = m.

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.

Setting user extensions when the Selenium Server has been started dynamically

I hope this helps someone someday, I needed to set user extension for a selenium test suite, dynamically in the code as i was starting the Selenium server via same. public void startSeleniumServer(String port) { rcc = new RemoteControlConfiguration(); rcc.setPort(Integer.parseInt(port)); try { seleniumServer = new SeleniumServer(false, rcc); seleniumServer.start(); } catch (Exception e) { throw new IllegalStateException("Can't start selenium server", e); } } public void stopSeleniumServer() { if (seleniumServer != null) { seleniumServer.

Selenium Remote cant start firefox session due to lock on file

>I am sure you have on this page, because you have run into problem with selenium not been able to run due to a lock on some profile files. Yes, you know what the error is. I really found useful two blogs here and here. However, inas much as i don not want to repeat what has been saidin the blogs i would paste and quote what i found useful and explain a little bit more.

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.