Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Is Data Scientist the Sexiest Job of the Century?

Hey good lookin'. Yep, I'm talking to you, or at least the data scientists reading this. (The rest of you are incredibly good looking, intelligent, and clearly have good taste, as well.) The Harvard Business Review has put Billy Crystal's "You Look Marvelous" on the hi-fi, dimmed the lights, and declared data science "The Sexiest Job of the 21st Century". Unfortunately for the single data scientists in Datastream's audience, the HBR doesn't offer any clever pickup lines about petabytes. The "sexiness" HBR refers to is more figurative than literal, investigating the current job market for skilled practitioners, who are in high-demand in the enterprise and among online behemoths such as LinkedIn. Still, being in high-demand among employers is a pretty good consolation prize, and if anyone produces a set of foolproof pickup lines for data scientists to use at cocktail mixers, we'll be sure to let you know.

Interacting with popup windows in Cucumber/Selenium

OAuth providers like LinkedIn often pop-up in a new browser window rather than in Javascript so that the user entering their credentials can see the location bar to be sure they are not being phished by the website requesting their credentials. This is great for security, but not so great for Cucumber testing.


Scenario: Sign Up with LinkedIn
  When I go to the home page
  And I follow "Sign Up"
  And I grant LinkedIn access
  Then I should be on the new user page

My application has a hyperlink that opens the OAuth login on the OAuth provider's website in a new window. Let's presume the simple matter of wiring this up is already coded in my view.

Testing this with Cucumber requires telling the Selenium web driver to interact with the new popup window. We can do this using page.driver.browser.window_handles to find the newest window handle and scoping out actions to that window.


When /^I grant LinkedIn access$/ do
    main, popup = page.driver.browser.window_handles
    within_window(popup) do
      fill_in("Email", :with => "")
      fill_in("Password", :with => "password")
      click_on("Ok, I'll Allow It")

And that's it!

Keep in mind that if you use this test as-is, you will be hitting LinkedIn on the real Internet. This is great if you want a test that will always verify the real API, but not so good for CI, since it is Internet connection-dependent and slow. Consider using something like VCR or Artifice to stub out your service calls.