Archive for November, 2011

Perl-Selenium Helpful String Manipulations

November 28, 2011 Leave a comment

Below are the string functions I found helpful during scripting in my current project using Selenium in Perl language:

– Splits the string EXPR into a list of strings based on given PATTERN and returns that list.

# Scenario: Clicking Email link opens new window. Verify new location/URL displayed is correct
# Email element: <a onclick=”‘http:test.url’,’EMAIL’,’width=730,height=450,status=yes,toolbar=no,menubar=no,location=no’);” style=”color: rgb(38, 6, 2); font-size: 11px; text-decoration: underline;” href=”javascript: void(0);”>Email</a>

my $href = $sel->get_attribute("xpath=//html/body/div[2]/div[2]/div[2]/table/tbody/tr/td[2]/div[3]/a/\@onclick");
# $href = "'http:test.url','EMAIL','width=730,height=450,status=yes,toolbar=no,menubar=no,location=no');"
my @url = split(/'+/, $href);
# @url = ['' , 'http:test.url' , ',' , 'EMAIL' , ',' , 'width=730,height=450,status=yes,toolbar=no,menubar=no,location=no' , ');' ]

– Extracts a substring out of EXPR and returns it based on defined OFFSET and LENGTH

# Scenario: Get the numeric value from the Total distance string element

my $str = $sel->get_text("css=div.olPopupContent>div.mainbubblecontent>div.mainbubbletabcontent>div.activetabcontent>div:nth-child(5)");
# $str = "Total distance: 100.25 miles";
my $distance = substr($str,16,5);
# $distance = '100.25';

Match (m/PATTERN/)
– match a string with a regular expression pattern

my $str = "Total distance: 100.25 miles";
 if ($str =~  m/ \d*.\d* miles/) {
   print "Pass";}
   print "Fail";}

Cmp_ok( $got, $op, $expected, $test_name )
– Test::More function that allows you to compare two arguments using any binary perl operator.

my $str = $sel->get_text("css=#panel > #collection_maneuvers > thead > tr > th");
# $str = "Total distance\: 100.25 miles"
cmp_ok($str, "=~", m/Total distance\: \d*.\d* miles/, "Verify estimated mileage is displayed");

Like( $got, qr/expected/, $test_name )
– Another Test::More function that evaluates any expression against a regular expression

my $str = $sel->get_text("css=#panel > #collection_poi > thead > tr.poi > th");
# $str = "5 locations found in your area"
like($str, qr/\d* locations found in your area/, "Verify number of locations is displayed");

Also came across this Perl documentation link ( which is direct and comprehensive.

Agile Testing

November 18, 2011 Leave a comment

I had the opportunity to attend one of the trainings on Agile Testing last August, 2011 conducted by CHEQ Systems. Inspired by this training I’ve compiled some of the basics of Agile Testing that I’ve learned:


Agile Testing is an iterative and incremental(evolutionary) approach to software development performed in a highly collaborative manner by self-organizing teams within an effective governance framework with “just enough” ceremony that produces high quality software in a cost effective and timely manner which meets the changing needs of the stakeholders.

Agile Values

  1. Individuals and interactions over processes and tools – emphasis on people and group interactions.
  2. Working software over comprehensive documentation – documentation is not a major goal but a supporting medium for the actual product – the software.
  3. Customer collaboration over contract negotiation – involving the customers in the software development rather than on detailed contract negotiation.
  4. Responding to change over following a plan – development progresses in response to user feedback, rather than as reaction to a fixed plan, but it does not mean that there is no plan.

Criteria in determining an Agile team

  1. Highest priority is to satisfy the customer
  2. Welcomes change
  3. Deliver working software frequently
  4. Business people and developers work closely together daily
  5. Build projects around motivated individuals
  6. Face to face communication is the best
  7. Working software is the primary measure of progress
  8. Promote sustainable development
  9. Continuous attention to technical excellence and good design enhances agility
  10. Simplicity
  11. The best architectures, requirements and design emerge from self-organizing teams
  12. Introspective – teams should regularly review itself and its processes for improvement

Criteria to determine an Agile Team

  1. There is an active participation of stakeholders/customers
  2. Developers do Test-Driven Development approach and do regression testing
  3. Team is producing high quality working software on a regular basis
  4. Team is highly collaborative and self-organizing
  5. Team is improving

That’s all for now, I’ll try to create a post for Agile Testing Strategies that the training highlighted.

2010 in Review

November 9, 2011 Leave a comment

The stats helper monkeys at mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Wow.

Crunchy numbers

Featured image

About 3 million people visit the Taj Mahal every year. This blog was viewed about 36,000 times in 2010. If it were the Taj Mahal, it would take about 4 days for that many people to see it.

In 2010, there were 4 new posts, growing the total archive of this blog to 43 posts. There were 3 pictures uploaded, taking up a total of 530kb.

The busiest day of the year was March 18th with 201 views. The most popular post that day was Creating Firefox profile for your Selenium RC tests.

Where did they come from?

The top referring sites in 2010 were,,,, and

Some visitors came searching, mostly for selenium firefox profile, selenium rc firefox profile, firefox profile selenium, selenium profile, and jmeter proxy.

Attractions in 2010

These are the posts and pages that got the most views in 2010.


Creating Firefox profile for your Selenium RC tests February 2009


JMeter 101: Using HTTP Proxy to Record your Test March 2009


Jmeter: Add “Cookie Manager” June 2009


JMeter: Run scripts from the console October 2009


Jmeter: Statistics Aggregate Report January 2010

Selenium RC to test unsecured connection HTTPS

November 9, 2011 Leave a comment

It’s inevitable for software testers to run test in an environment with self-signed SSL certificates. This became one of my dilemma when trying to run my Selenium scripts in an HTTPS environment and was always prompted with “This Connection is Untrusted” error.

I have an existing Firefox Profile solely for Selenium, if you don’t have one, you can check this post.  Was able to resolve this issue by doing the following:

  1. Launch Profile Manager by typing “firefox -ProfileManager -no-remote” in your terminal (Linux user)
  2. Select Selenium profile then Start Firefox
  3. Access your web application URL in HTTPS
  4. Accept the SSL Certification:
      • Click “I Understand the Risks”
      • Click “Add Exception”
      • Click “Get Certificate”
      • Make sure “Permanently store this exception” tickbox is checked
      • Click “Confirm Security Exception”
  5. After successfully directed to the web application page, close Firefox
  6. Go to Selenium Profile folder ( in my case /home/girlie/.mozilla/firefox/selenium )
  7. Delete all files except for cert_override.txt and cert8.db files.

From here on, I rerun my Selenium scripts and didn’t encountered the “This Connection is Untrusted” error anymore 😀