Matt RaibleMatt Raible is a Java Champion and Developer Advocate at Okta. developer.okta.com

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: AngularJS, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Last Night's Selenium Users Meetup at Google

Last night, I attended the inaugural Selenium User Group meetup at Google's Campus in Mountain View. It was an excellent event, with many of the core committers on hand to present and answer questions. Each presenter had about 5 minutes to speak and we learned many things about the Selenium Project itself, what's coming in the future and how Google has standardized on Selenium as their integration testing tool of choice.

Patrick Lightbody started the meeting by going over a number of project statistics with pretty graphs and such. There were simply too many numbers to write down, so hopefully his slides will be published soon. I was pleased to see that Google did videotape the entire event, so it should be available online soon. I'll update this post when it it. Below are my notes from the event.

Jason Huggins, Test Engineer at Google
Selenium is a test automation framework. Some folks abuse it as a macro tool. There's two reasons Selenium became so popular: it was able to test Ajax before any other testing tool and it allows end-to-end workflow testing. Selenium works on any platform, with any browser and allows many, many languages. It's possible that other frameworks that are more focused are better. There are 4 Selenium products:

  • Selenium Core (TestRunner)
  • Selenium IDE (for Firefox)
  • Selenium Remote Control
  • Selenium Grid

Paul Hammant, Open Source Manager at Thoughtworks
Selenium 1.0 - beta this week. RC, Core, Grid and IDE together. 1.0 will be shipped in a few weeks. Compared to today, lots of bugs killed, documentation improved and a greatly improved Selenium IDE.

Selenium 1.1 will be shipped in a couple months. Selenium IDE will be enhanced to obey RC instruction ... becoming the best mode of operation when it ships.

Some experimental iPhone-Safari capability (dependent on SDK for iPhone).

Selenium 2.0 will hopefully be released this year. Roll in of WebDriver functionality and code. New model-based API. IE plugin and Safari plugin (not really a plugin, most likely uses AppleScript).

Philippe Hanrigou (http://ph7spot.com)
Testing is good! Selenium is awesome! However, end-to-end web testing is slow. It is and always will be slow. How do you solve this problem? You solve it the same way we've solved slow traffic in the past - by building more lanes. Rather than one browser testing everything, Selenium Grid allows multiple lanes and 20 browsers. Features include:

  • Faster Builds, Faster Feedback!
  • Easy Install and Everyday Use
  • No Need to Change Your Tests
  • Leverage Your Existing Computing Infrastructure

One of the best parts about Selenium Grid is you can download and have it running in 10 minutes or less. Selenium Grid comes out-of-the-box with Amazon EC2 support.

Jennifer Bevan, Lead from Selenium Farm Project at Google
As of Friday, Google has over 50 teams running over 51K tests per day on internal Selenium Farm. 96% of these tests are handled by Selenium RC and the Farm machines correctly. The other 4% are partly due to RC bugs, partly to test errors, but isolating the cause can be difficult. Selenium has been adopted as the primary technology for functional testing of web applications within Google. That's the good news.

The bad news is Google is pushing the limits of Selenium. Using Selenium (RC + Core) at this scale exposed certain issues not originally anticipated as high-impact. IE/XPath slowness has a high impaction given that can only run one test at a time. Tests can cause many conditions from which RC cannot easily or automatically recover (for example, tests that don't call stop() in every exit path). Unexpected browser dialogs, popups, etc. eventually cause timeout exceptions.

Googlers expect that RC will work for the most part, but they want it to be more reliable, with better performance. So they have:

  1. Created utility methods to improve performance when examinging large tables, overlaying domain-specific languages, etc.
  2. Deployed retry policies based on failure reason.

Looking to the future - Google has not yet reached their expected usage of Selenium RC. Some projects cannot use the Farm until RC supports session-level configuration (not server-level). Many just want RC to be more reliable. So Google will:

  1. Continue to contribute to RC, Core and to user-created helper libraries.
  2. Keep doing so until all failed tests are not Selenium's fault.

Dave Astels, Google (Driving Selenium with RSpec)
Using RSpec, you can create a very easy-to-read Story with Scenarios that can be read (and likely written) by practically anyone. Dave then uses a small script to load up the stories and run them in Selenium. When he runs the script, the scenario is spit out and test pass/fail information. Learn more at rspec.info.

Alex Chaffee, Mad Scientist at Pivotal Labs (The Selenium/Ruby Project that Must Not Be Named)
What is Polonium? It's also known as Selenium RC Fu or Selenium On Rails 2 or Funkytown. It has simple extensions to Selenium RC:

  • wait_for
  • element assertions
  • launching/managing servers locally

Blackbox testing you're sitting out of the box and send in stuff. In whitebox testing, you get to open up the box and look at stuff. With Selenium, you can do Graybox testing, where you are doing blackbox testing (against the UI) and querying your database (or other resources) at the same time.

Dan Faulich, Sr. QA Engineer at Redfin Corporation (How Not to Run a Successful Open Source Project)
The first thing you don't want to do is support everything. The second thing you don't want to do is write your project in JavaScript. While it's great that almost anyone can hack on it, running in a sandbox sucks. Don't use a language that's bound by other people's security restrictions. Don't roll your own multi-language remoting. It's written using XML + XSLT and its such a pain in the ass to maintain that Dan is the only one that fixes bugs.

Shinya Kasatani, Developer of Selenium IDE
Selenium IDE is a Firefox extension that can record and play back tests in your browser. It can translate the recorded tests to many languages.

Selenium IDE 1.0 adds support for TestSuites. Another new feature is better recording features - it detects when the DOM is modified. Shinya has a demo where he uses the new IDE to test the Dojo Dijit Theme Test Page. Apparently, this doesn't work in the current version.

The Goal of Selenium IDE is to get more people interested in test automation of web applications and to help their projects to be successful.

Haw-bin Chai, Developer at CommerceHub
XPath is a powerful selection took, but it'd be great if we could use something like "article 5" instead of the cryptic //table[5]/tbody/... syntax.

Why UI-Element? Traditional locations can be ugly and they don't convey purpose. UI-Element is a Selenium Core extension and has Selenium IDE integration. It's written in 100% JavaScript. Examples:

ui=frontPage::topStoriesCountry()
ui=listingPages::article(index=5)
ui=listingPages::articleSource(articleIndex=1)

The UI Map is in JavaScript shorthand. It contains logic to map ui locators to traditional locations. Each UI element implements getLocator(), then you add a page set and add an element - all in JSON Format.

Simon Stewart on Web Driver
What on earth is Web Driver? One of the main problems with Selenium is it's written in JavaScript and it's too easy to hack. WebDriver is an idealized browser which allows you to do browser things like call get(URL), findElement(By.xpath()) and getTitle(). WebDriver is similar to Selenium RC, but it's not written using JavaScript. It's written in the native languages for each browser, which allows you to break out of the JavaScript Jail. The IE Driver is written in COM (C++). The Firefox Driver is written as a Firefox extension. Safari uses Apple events.

Soon there won't be a WebDriver project ... because it will be part of Selenium!

WebDriver likely won't be part of the core until Selenium 2.0 later this year. One of the nice things about WebDriver is you can implement different browsers. Out-of-the-box, it will support all the major browsers, as well as HtmlUnit with JavaScript turned off.

I had a great time learning more about Selenium and how most of its problems will be solved in the near future. The beers afterwards weren't so bad either. ;-)

Update: Videos of this event have been posted.

Posted in Open Source at Feb 26 2008, 03:51:56 PM MST 10 Comments
Comments:

Excellent write up Matt! It's a great resource for the community, particularly those who were unable to attend. I'm glad you enjoyed the meetup.

Just to clarify, Selenium Grid can run a lot more than 20 browsers. ;-) During the lightening talk I demonstrated that you could run 20 browsers on a MacBook pro. Nevertheless, in real-life, a Selenium grid will typically span multiple machines. If you use average desktop computers as part of your grid you will typically end up with 10 * N browsers (where N is the number of machines).

Have fun with the Grid!

Cheers,
Philippe Hanrigou

Posted by Philippe Hanrigou on February 29, 2008 at 11:18 PM MST #

[Trackback] Videos of last week's Selenium User Meetup have been posted on YouTube. You can watch them below or click on the video to watch it on YouTube. Enjoy! Lightning Talks Q and A Session

Posted by Raible Designs on March 05, 2008 at 10:24 PM MST #

Hi
I am a new user in Selenium.I recorded the application in IDE.When i tried to run the script using Test Runner i got an error.
2).How can we integrate selenium IDE with RC?

Posted by sankarsan choudhury on March 10, 2008 at 06:11 AM MDT #

XPath is a powerful selection took, but it'd be great if we could use something like "article 5" instead of the cryptic //table[5]/tbody/... syntax.

More articales writing on .net or microsoft technologies are more better par industry expectations. It's a fine tool compare to other tools ROI. More libraries have to implement to analyze the bottlenecks of the machine. I will post soon on performance testing using selenium IDE includes RC.

Posted by Rajender Cheekoti on March 31, 2008 at 02:50 AM MDT #

Hi, I have couple of questions regarding Selenium. 1. Can I provide multiple values to the element locator? e.g: I have three image link on the same page Called 'Add'. How do I provide a value so that an intented one is clicked? Using Index? 2. I have a problem clickin on a image link, though I can highlight the same object. What could be the reason? 3. While using Selenium IDE, It recorded one statement as 'Selenium.Click("link=Add"). I want to replace this with Xpath now. How do I find the Xpath? Thanks, Saurabh

Posted by Saurabh Singhal on April 22, 2008 at 02:47 PM MDT #

Please let me know how to place comments in Selenium Html format,i mean is there any syntax to place comments in HTML table formatted SELENIUM IDE genrated code ???

Posted by virender singh on June 11, 2008 at 04:30 AM MDT #

I worked on Selenium tests for my company for a while. I have different thought of using Selenium IDE to create selenium tests. It is not really flexible for developers. I created a framework to abstract the UI components as Java objects so that developers can write selenium tests just like writing JUnit tests. The framework does not depend on Selenium IDE at all, but rather than depends on the XPather plugin for firefox. The first version was written in Java and the current one is in Groovy so that we can have use DSL to define the UI objects and write the actions.

More thoughts will be on creating an object to locator mapping framework to reduce the amount of effect to get the UI locators (XPATH /CSS selector) manually. It is still under developing.

I just uploaded to project to google code. If interested, please take a look at:

http://code.google.com/p/aost/

Any constructive comments and suggests are welcome.

Posted by Jian Fang on June 26, 2008 at 10:40 AM MDT #

July 12, AOST 0.3.0 is out, which includes an Object to Locator Mapping framework (OLM),. With that, AOST can automatically generate the UI object locator for you. AOST also implements the group locating concept to utilize information in a group of UI objects to help finding their locators. The new version also add the composite locator so that user specifies a set of parameters for the object and the actual locator will be derived automatically by AOST. The new version also supports multiple UI modules in a single DslContext.

For example, the google start page could be defined as:

ui.Container(uid: "google_start_page", clocator: [tag: "td"]){
  InputBox(uid: "searchbox", clocator: [title: "Google Search"])
  SubmitButton(uid: "googlesearch", clocator: [name: "btnG", value: "Google Search"])
  SubmitButton(uid: "Imfeelinglucky", clocator: [value: "I'm Feeling Lucky"])
}

where clocator denotes composite locator and the test can be expressed in DSL as,

type "searchbox", input
click "googlesearch"

Please see the project home

http://code.google.com/p/aost

for details.

I added FAQ at:

Introduction at: http://code.google.com/p/aost/wiki/Introduction

and Tutorial at: http://code.google.com/p/aost/wiki/Tutorial

Thanks.

Posted by Jian Fang on July 15, 2008 at 09:03 PM MDT #

Hi.I have a question refered to SELENIUM IDE and GWT Applications.I have on a page three elements with the same NAME, and dynamic target(i have a long XPATH for each

for example:

/html[@id='ext-gen266']/body[@id='ext-gen6']/div[@id='ext-gen96']/div[@id='ext-gen132']/div[@id='ext-gen133']/div[@id='CmsGui_global']/div[@id='ext-gen134']/div[@id='ext-gen135']/div[@id='CmsGui_center']/div[@id='ext-gen169']/div[@id='ext-gen170']/div[@id='ext-gen128']/div[@id='ext-gen171']/div[@id='ext-gen172']/div[@id='ext-gen173']/div[@id='ext-gen221']/div[@id='ext-gen222']/div[@id='ext-gen175']/div[@id='ext-gen229']/div[@id='ext-gen230']/table[@id='ext-gen177']/tbody/tr/td[@id='ext-gen271']

I don't know how i can find on the page the element that i have selected, or how i put this Xpaths in the text.

Thanks

Posted by Romina on November 04, 2009 at 05:38 AM MST #

@Romina - I would suggest using XPath's // notation as a wildcard to search for ids without an absolute path. I would also name your GWT elements using widget.getElement().setId("foo"). Keep in mind that often this id is given to a wrapper <div> and you still may need to traverse to the underlying element you're looking for.

Posted by Matt Raible on November 04, 2009 at 09:11 AM MST #

Post a Comment:
  • HTML Syntax: Allowed