Archive for the ‘quality assurance’ Category

Cucumber: Verify page content from a data source

July 21, 2014 1 comment

One good practice in “Cuking” is to not crowd your feature files with all the text validations. In this post I’ll be sharing how you can use an external data source to be compared with the actual UI page for content validation purposes.

First prepare your textfile by inputting all the expected content in the page you want to assert. Save this in a your desired location which later on you’ll need to specify in your step definition.

Step Definition

And /^I verify ([^"]*) page content$/ do |page|
 case page
   when 'Terms and Conditions'
     $file = File.expand_path(File.dirname(__FILE__) + '/{location of your file}/terms_and_conditions.txt')
   #you can add other pages to validate within the case
 $content =$file)
 $content.readlines.each do |line|
   puts "#{line}"
   page.text.should have_content("#{line}")

In your feature file assuming all the other step definitions are in place, you’ll just need to call your ‘I verify ([^”]*) page content’ step with the page variable in our example ‘Terms and Conditions’

Scenario: User verify contents of Home page
  Given User go to Terms and Conditions page
  And I verify Terms and Conditions page content

In other cases that you nedd to save your text validations in a csv data source, for example maintaining a csv file with all the expected labels per page:


Your step definition should look something like this:

And /^I verify fields from "([^"]*)"$/ do |page|
  $source = "/{location of your file}/fields.csv"
  FasterCSV.foreach(File.expand_path(File.dirname(__FILE__) + "#{$source}"), :headers => true) do |row|
      if row.header?("#{page}")
        if row["#{page"] != nil
          puts row["#{page}"]
          $field = row["#{page}"]
          page.text.should match(/#{$field}/)
    rescue => e
      raise e

Then in your feature file, you just call the step definition with the csv’s column header as a parameter:

Scenario: User verify contents of Home page
  Given User go to Login page
   Then I verify fields from "Login Page"
   And User go to Registration Page
   Then I verify fields from "Registration Page"

What are You Doing?

May 29, 2012 Leave a comment

An investor once visited an IT company and was accompanied to the Quality Assurance department. He approached the QA Analysts and tried to do some small talk.

Investor: What are you guys doing?

Employee #1: Well, I’m executing these bunch of test scenarios repeatedly.

Image taken from

Employee #2: Well, I’m trying to earn a living.

New Peso Bills

Employee #3: Well, I make sure users will have a valuable experience with this cool stuff we are developing.

QA guys at work (Image taken by Ram Masinas)

Although the three employees are doing the same task, only one of them sees the bigger picture of their work and truly understands the value of their job. #Perspective

How about you, what are you really doing?

Categories: quality assurance Tags: ,

Testing versus Checking

January 26, 2012 Leave a comment

I stumble upon this blog post Testing vs. Checking by Michael Bolton which I found very interesting and a fundamental for software testers. I tried to summarize it and place it in a table to see the distinction clearly.

Checking Testing
confirming existing beliefs finding new information
a process of confirmation, verification, and validation a process of exploration, discovery, investigation, and learning
focused on making sure that the program doesn’t fail focused on “learning sufficiently everything that matters about how the program works and about how it might not work.” – James Bach
We are checking when:
* we’ve made a change to the code and we want to make sure that everything that worked before still works. When we have an assumption that’s important, we check to make sure the assumption holds.
* developers write and modify their code, creating automated routines that they run frequently to check to make sure that the code hasn’t broken
We are testing when:
* we configure, operate, and observe a product with the intention of evaluating it, or with the intention of recognizing a problem that we hadn’t anticipated
* when we’re trying to find out about the extents and limitations of the product and its design, and when we’re largely driven by questions that haven’t been answered or even asked before
A check provides a binary result—true or false, yes or no A test has an open-ended result
is all about asking and answering the question, “Does this assertion pass or fail?” is about asking and answering the question “Is there a problem here?”
checking can prove the presence of bugs, but not their absence the process of finding out whether our checks have been good enough
machine-decidable and are, in and of themselves, value-neutral requires human, which makes it a sapient process
when done by a programmer, is mostly a quality assurance practice. The quality assurance angle: a programmer helps to assure the quality of his work by checking it. is not quality assurance, but acts in service to it; we supply information to programmers and managers who have the authority to make decisions about the project.

Checkers Testers
A person who needs a clear, complete, up-to-date, unambiguous specification to proceed Does not require the certainty of a perfect specification to make useful observations and inferences about the product
A person who needs a test script to proceed His job is to discover information; often that information is in terms of inconsistencies between what people think and what’s true in reality
A person who does nothing but to compare a program against some reference A tester’s task might be to reveal problems that occur when our excellent code calls buggy code in someone else’s library, for which we don’t have a specification

I also liked how James Bach describes testing, “questioning a product in order to evaluate it.” Evaluation of a product doesn’t assure its quality, but it can inform decisions that will have an impact on quality.

Though people may or may not agree with these, it made me understand where to draw the line. =) Thanks Michael!

Helpful Unix Commands

December 15, 2011 Leave a comment

Below are the helpful Unix commands I learned when we handled SHINE project, where part of our QA task is to checkout/update the latest SVN codes, run maven and jetty in order for us to setup a local build and run our Selenium scripts.

1. ps aux – ps short for “process status” displays all the currently-running processes in the terminal

aux is an option where:
“a” lists all processes on a terminal, including those of other users,
“u” adds a column for the controlling user for each process, and
“x” lists all processes without controlling terminals

2. grep – searches files or string that matches the given expression

grep “id=inputaddress” *.pl – searches all files with “.pl” extension and returns files with string “id=inputaddress”

3. pipe “|” – allows you to execute number of commands in sequence

ps aux | grep jetty – displays all the currently-running processes in the terminal and filters the jetty process

exist     7712  0.0  0.0   8952   876 pts/0    S+   18:21   0:00 grep –color=auto jetty

4. kill  – sends termination signal, which requests that the process exit.

In our project we frequently used the command “kill -9” everytime our scripts hang and Google taught me that there are several ways to kill a task. Based on our output in item #3 let’s try to kill the jetty process with process ID 7712:

-9 and -KILL are options to send SIGKILL, a signal sent to a process to cause it to terminate immediately
kill -9 7712
kill -KILL 7712

-15 and -TERM are options for SIGTERM, a signal sent to a process to request its termination. This signal can do useful cleanup operations (e.g. saving configuration information to a file) before quitting
kill -15 7712
kill -TERM 7712

5. dpkg -L {package} – List where files/package are installed

dpkg -L maven2 – list where Maven is installed

Categories: quality assurance, unix Tags: ,

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