Selenium: What is it Good For?

Absolutely Something!

Dallas Drupal Users Group Power User Meetup
September 17, 2012

Whatcha Gonna Do?

  • Selenium
    • Selenium IDE: A comprehensive walkthrough of the misunderstood IDE.
    • Store and Run Tests: A guide to Automated Testing at it's most basic level.
  • PHPUnit
    • The Important Features: What we need to get Selenium working with PHPUnit.
    • Translation from Selenium IDE: The first steps to using PHPUnit for managing and running your tests.
  • Continuous Integration
    • Overview: What does it mean to be continuously integrated?
    • Using Jenkins: A quick use case for using Continuous Integration.

BUT FIRST!

<SHAMELESS SELF PROMOTION>

About Me

Allan Chappell
Webdeveloper / Testing Expert

Drupal User: 368854
Twitter: @general_redneck
Blog: GeneralRedneck.com


Projects

Headless Selenium
Test Case Manager

</SHAMELESS SELF PROMOTION>

 

What is Selenium?

Selenium automates browsers. That's it.

Selenium

Selenium IDE

  • Record Your Actions.
  • Modify Your Targets.
  • Fill In the Gaps With Tests.
  • Store and Run Your Tests.

Selenium IDE

Record Your Actions.

Live Demo Time!

Store Tests

Warning: Conflicting Information!

If you plan to move on to more advanced testing:

Separate different features into different Test Suites.


If you plan to stick with what you got now:

Combine all features into the same Test Suite.

Store Tests

For both do:

  • Separate tests into logical test cases.
  • Share and reap the rewards!

Run Tests

  • Make a backup of the database.
    (Check out backup and migrate)
  • Run the Tests!
  • Restore if needed.

<blink>

CONGRATULATIONS!!!

You are ready to move to the next level!

</blink>


Where does PHPUnit come in?

PHPUnit allows you to make the process more automated!

PHPUnit

Selenium Feature Overview

  • You can run your old tests! (with massaging)
  • You can now perform repetitive tasks!
  • You can now chain running your tests to events!

Translation of Selenium tests

There are 2 ways!

  • PHP Export Addon
  • Throwing your selenese test cases into a directory and telling PHPUnit to run em.

<Impersonate class='audience'>

Great... But how to do I use it?

</Impersonate>


Live Demo Time!


<blink>

CONGRATULATIONS!!!

You've leveled up twice in an hour!

</blink>

You should feel proud of yourself... No, Really!

There's MORE?!? I thought I made the tests automated?

But you can do more with continuous integration provided by a platform such as Travis, Hudson, Jenkins.

Continuous Integration

Overview

Continuous Integration (CI) there to help your work's quality by:

  • Taking repetitive manual tasks and automating them
  • Doing these tasks more frequently
  • And doing these task faster!

Things That Now Become Easier and Possible

  • Code standard checking
  • Processing Tasks on events such as commits!
  • More information in an already formatted report!
  • Running Tests

To Complete This Level You Must...

  • Install a CI system: Hudson, Jenkins, and Travis are all free with great documentation.
  • Build a job: Usually tell it when to run. For instance, on git commit to github, or every night at midnight.
  • Tell it what to do: Anything commandline will run. PHPUnit is commandline. Hudson, Travis, have Selenium built in!

Jenkins

The Live Demo


<blink>

CONGRATULATIONS!!!

You've made it to The End!

</blink>

But wait there's one more thing...

What this means is that you now have a choice based on the following...

  • How Automated do you want to go.
  • What works for your team?
  • How many resources do you have to dedicate to automation?


In the end, it is almost always best for your product to get to the last level.


Questions?