Archive for the ‘Uncategorized’ Category.

Instructional Video Table of Contents (YouTube)

Today I found this link to the  YouTube Iframe API Reference.  I find this interesting because I think that adding something like a table of contents to a video could be super helpful when if you want to reference the video. For example with instructional videos, a table of contents could provide an overview of video segments you might be interested in. It would let you quickly jump around instead of manually searching the video to find the point that you are interested in.
I used to go to user group meetings to find out the latest and greatest in programming and software development.  I could see this API being used after the video is filmed and adding click points.  I always want to tell friends about something that I learned at a presentation, and with the content links I could share the exact point where I liked the content.
I can imagine if video place markers were sharable then we might have metrics where we can see what points of a video are getting the most interest and shares.

Creative Inspiring Motivator

Recently my team at HomeAway got personal profiles done from http://www.insights.com. It was quite a fun process. Under their categorization, I am a Creative Inspiring Motivator.  This is what came back as my key strengths:

  • Outwardly directed energy ensures a fast friendly pace.
  • Creative thinker and dynamic innovator.
  • A natural entrepreneur, inquisitive and adaptable.
  • Builds relationships quickly and effectively.
  • Able to see the larger picture.
  • Takes advantage of opportunities.
  • Ability to see options and alternatives.
  • A visionary generating infectious enthusiasm.
  • Able to turn vision into a reality.
  • Enjoys having lots of harmonious relationships.

Today I met Matz. The creator of Ruby.

This is might not be a big deal for others who have been going to the lone star ruby conference for a while, but I got to finally hear Matz today.

I snapped a quick picture along with two of my team members from HomeAway. I am the guy on the right.

Matz used his keynote to talk about features to come in the next version of ruby such as  scoped monkey patching, module prepending, lazy mapping, and ruby keyword arguments.

He also mentioned mruby, that is coming soon.  I checked out the source and ran the tests. Here is the source link https://github.com/mruby/mruby/

download the source and run ‘make’ and ‘make test’.  You will then find mruby, mirb in the bin directory.

James,Alan, and myself with Matz.

 

Lightning Talk From Selenium Conference

Checkout my lightning talk on SeleniumFury the page object factory for Ruby.
Lightning Talk From Selenium Conference

Going to Software Test Professionals Conference next week.

I am looking forward to my first trip to Las Vegas http://www.stpcon.com/. I will have a chance to meet with other selenium grid users and test out my strategies in test automation patterns. I will be attending all of the topics on agile automation

Selenium Grid Projects

What I have already done to update the ruby example in the Selenium Grid repo. Code Link

  • Updated rspec from 1.1.8 to 1.1.12. I accomplished this by getting the most recent deep-test code  and adding it to the /lib directory. The new version of the deep test code supports rspec 1.1.12. I then just require it in in the rake file. require File.expand_path(File.dirname(__FILE__) + ‘/lib/deep_test/rake_tasks’)
  • The rake file does not need selenium-client 1.2.7. I removed the dependency by  adding the reporting files it was referencing into the lib/reporting  directory. report_formatter_path = “lib/reporting/selenium_test_report_formatter”
  • Updated selenium-client from 1.2.7 to 1.2.18. With the change to the rake file, I am now able to use the most recent version of selenium-client in my specs.

Other helpful tools/tricks I have added to selenium grid (Maybe useful to other Ruby/Grid users)

  • I start and stop the grid from the same rake file that I execute the tests from. Examples are grid:all_start and spec:run_in_parallel
  • Rake tasks can just run and create a HTML report or run and send test results to Rally
  • The tests and rake file runs on OS X, Cent OS, and Windows. (no parallelizaion on windows)
  • Specify command options to the rake tasks to switch between hostnames I am running against. (This is useful when you have more than one instance like test.yourdomain.com and stage.yourdomain.com)
  • Specify to only run tests for specific sites in the test suit. For example if you wrote tests for www.yourdomain.com and www.yourdomain.es.  You can specify which sites to run against
  • I use gem bundler with all grid projects to help control gem installation and versions.  (My Rakefile automatically installs needed gems if you don’t have them)
  • I have a framework for creating ruby classes with selenium locators automatically. I use nokogiri to help with this.
  • Spec test to open ruby classes with locators and create a report of all of the changed selenium locators.

Future Goals

  • Update Deep Test so that it uses the same version(1.2.8) of rspec as the latest version of Selenium-Client. Right now we are at rspec 1.1.12 and selenium client 1.2.18. Selenium-Client 1.2.18 can use rspec 1.2.8.
  • When rspec is updated, I will be able to use the selenium client to provide screen shots if needed
  • Figure out how to create a formatter that allows the Team City and Rubymine spec runners to provide the same test runner template as it does for test in sequence when you run test in parallel in deep test.
    Rubymine Spec Formatter

    Rubymine Spec Formatter

    Team City Test Report

Selenium-Client 1.2.18 has excellent logging and error messages.

I am impressed with the new logging and stability features of  Selenium-Client 1.2.18. One of the most useful improvements is the automatic failure when a page is showing service unavailable.

I used to put a line like this after every browser.open command.

browser.text?("Http/1.1 Service Unavailable").should(be_false)

Now I get a nice error message from the Selenium-Client.
Selenium::CommandError: Response_Code = 503 Error_Message = Service Unavailable

Test navigation in Rubymine (control +T )

I like to navigate through Rubymine using only keyboard shortcuts if I can. One of the most useful techniques I have found is mapping a keyboard shortcut to enable you to run the test that your cursor is on. This way you can navigate up and down tests using ctl + up or down and then run the test your interested in with your key stroke. Even though I am on a Mac I prefer running a test to be mapped to control + t. The default configuration for this is command + alt + F8. The keymap configuration is under the label Run context configuration, which is under the All Actions -> Other section in the Keymap configuration menu.

Picture 2

The other shortcut that goes well with this one is Go To Test. I can put my cursor on a class name and press alt+shift+t and I can view the tests implementation for this class. Then I can use the short cut I created ctrl + t to run a test I am interested in.

Configure the Team City rake runner to launch Selenium Grid tests.

This article will describe how I was able to use the team city rake runner to launch selenium grid tests.  I learned a few tricks to get this to work correctly.   I first had to learn the makeup of a rspec specktask.  Next I needed to understand how to pass in spec options and lastly I needed to write a rake task that would execute in an exact order.  I needed to still generate the html report with the rake task so I had to add the formatter path to the rake runner

Setup the report formatter path in your rake runner like you do in your rake file.
See the code below to see how the formatter path is setup in the rake file. You can also see how the formatter path is used by the rake task.

# Make sure we pick up the reporter from the appropriate selenium-client
# install as RSpec runner --require does not discriminate between multiple
# selenium-client gems.
report_formatter_path = `gem which -q "selenium/rspec/reporting/selenium_test_report_formatter"`.chomp
report_formatter_path.gsub! /selenium-client-\d+\.\d+.\d+/, "selenium-client-1.2.7"
Spec::Rake::SpecTask.new("spec:run_in_parallel_report") do |t|
  t.spec_files = FileList['./*_spec.rb']
  t.deep_test :number_of_workers => 6,
              :timeout_in_seconds => 300
  t.spec_opts << '--color'
  t.spec_opts << "--require 'rubygems,#{report_formatter_path}'"
  t.spec_opts << "--format=Selenium::RSpec::SeleniumTestReportFormatter:./tmp/test_report.html"
  t.spec_opts << "--format=progress"
  t.fail_on_error = false
end

Setup the spec opts in the rake runner.
See the image below. I need to tell team city which formatter to use and where to put the html report. To pass in spec options to the rake runner in team city just put them in the text field labeled RSpec options(SPEC_OPTS): .
My full spec ops string is:

–require ‘/usr/lib/ruby/gems/1.8/gems/selenium-client-1.2.7/lib/selenium/rspec/reporting/selenium_test_report_formatter.rb’ –format=Selenium::RSpec::SeleniumTestReportFormatter:./tmp/test_report.html
RakeRunner

Run your rake task.
I made a rake task to take selenium grid environment variables as arguments.  If you wanted to run the task above, just add the task name  “spec:run_in_parallel_report” in your rake configuration. You don’t need any command line parameters for the spec:run_in_parallel_report task.

Run selenium ruby scripts in parallel from Team City.

I recently found out why my automated tests run in parallel from my workstation, but then run in sequence from a team city build agent.  It all comes down to the rake runner in team city.  Team city uses a customized rake runner that extends rspec’s spec task.  You get all of the per test reporting, graphing and historical information from team city’s customized rspec reporting.  All this is great if you don’t mind running your tests in sequence, but If your using team city to launch automated web test using the selenium grid this is bad news.

I use a rake file to control the execution of my ruby selenium scripts. I modeled it from the ruby example in the selenium grid distribution. What is important to know about the run in parallel rake task is that it is not your normal rake task. It is first a rspec spec task.  This is a test runner from rspec that allows you to use a rake task to run specs. Not only is it a spec task, it also has been overridden by deep test, the software package that adds parallelization.  Since the spec task is actually deep test’s spec task and not the rspec spec task there are dependencies on what version of rspec deep tests needs.  You must run with rspec 1.1.8 so that the spec task that deep test overrides will work correctly.

So what happens when you run your deep test spec task from team city with their rake runner?   Deep test cannot launch your tests in parallel because Team City is using their customized spec task.  The solution is to use the command line runner to launch your rake task for the selenium grid, then your spec task will have access to the correct rspec gem for deep test to use as a spec runner.