Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Do you really want to delete this prezi?
Neither you, nor the coeditors you shared it with will be able to recover it again.
Make your likes visible on Facebook?
You can change this under Settings & Account at any time.
Jeffrey Knurekon 16 August 2013
Transcript of selenium
info: Not building. Assuming client assets already exist.
info: Checking if external files exist
info: Running tests with Phantom - default
info: Starting Phantom
info: this test run will repeat: 0
info: Environment is 'test-native'
16:54:26 root info Loading test file /Users/jeffknurek/Sites/martini/app/test/meetup/meetupDemo.test.coffee
16:54:27 root test Running UI suite 'demo.meetup'
16:54:27 root test Suite 'before' setup
basic page info
◦ should have a page title that matches: 16:54:27 root test beforeEach test navigate to meetup page
16:54:27 root test @loadPage http://www.meetup.com/seleniumsanfrancisco/
16:54:29 root test @getInnerHtmlByCss div#chapter-banner a > span
16:54:29 root test @getElementByCss div#chapter-banner a > spa
✓ should have a page title that matches (582ms)
16:54:29 root test Suite 'afterEach' teardown
◦ should have the correct url: 16:54:29 root test
16:54:29 root test @loadPage http://www.meetup.co
16:54:31 root test @getCurrentUrl
16:54:31 root test -- current url is http://www.me
16:54:31 root info getting pageUrl
✓ should have the correct url
16:54:31 root test Suite 'afterEach' teardown
◦ should have my meetup next: 16:54:31 ro
16:54:31 root test @loadPage http://www.me
16:54:32 root test @getInnerHtmlByCss div#e
16:54:32 root test @getElementByCss div#eve
✓ should have my meetup next
3 key components to framework
Page Object Model
Code objects that model the services of a web page
Runs the Unit tests and Functional tests
Queue, execute, report test cases
Bail on failed tests
Default functionality to bail test run when single test fails
Before/BeforeEach to configure pre-requirements to the tests
Which browser to test when
Running the stand-alone server
Object to wrap the functionality of Webdriver for the tests.
If/when changing driver module, tests don't need to be refactored
Starts the app, starts a browser, starts and ends test
Attempt a live demo
Run test script
coffee ./run-tests.coffee -h
Promises to callbacks
But we want to use the same paradigm as the application code
Server time varies, so let the driver determine how long to wait
Starting the app/browser
CoffeeScript, Page Object Model, and WebDriverJs
Tests shouldn't know how the dom works
Inspired by languages like Ruby and Python
An alternative Node.js client for Selenium
Tests don't care about waiting
DriverWrapper creates a consistent way to manage waiting
Promises are a powerful and logical feature to Node & selenium-webdriver
Promise is an object that represents a value, or the eventual computation of a value
BDD, TDD, QUnit interfaces
Forked and added an option to bail the suite, but continue other scheduled tests
After/AfterEach to teardown and handle failures
Unit tests are run on phantom
quick startup and compilation of the dom
Allows for screen-capture, dom manipulation
Execute the tests against Firefox/Chrome (or PhantomJs) (developing on Mac, so no IE)
Add implicit wait while writing the test
Another fork to emit a failure event that the test can listen for
Screen comparison (Wraith/Hukley)
Distribute more tests in parallel
dom comparison (run diff on raw html)
Performance & Monitoring
Node.js is a platform for easily building fast, scalable network applications.
It uses an event-driven I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Protect the test from flakiness
Allows for previous tests to fail without effecting the current test
Each test suite starts fresh
Make it easy for QA to track down failures
Log the error
This runs front-end tests.
./node_modules/.bin/coffee ./run-tests.coffee --tb --bail -n test-native login-form navigation
[For boolean values, simply adding the parameter marks it true]
[For running specific test(s), just add the test name without any parameter]
-h, --help This message.
-b, --browser Which browser to run the tests in. [default: "phantomjs"]
--bail Force mocha to bail after the first failure test.
-l, --level The level of testing to run. Current options are: [happy|accept|full]
--nc, --no-colors Default to force mocha to output colors, but allow to turn colors off.
-n, --node-env Used to configure settings. [default: "test"]
--os, --os-platform When running through sauce labs, set the OS to test against. [default: "Mac 10.6"]
-p, --start-phantom Start phantom for tests that need a headless browser running.
--random Randomize the test order
--repeat Repeat this test run an addition N times [default: 0]
-r, --reporter The mocha reporter to use [default: "spec"]
-s, --selenium Start selenium server to run tests.
--sl, --sauce-labs Run tests tunnelling through sauce labs.
--tb, --test-browser Boolean to determine if tests run in a browser.
--to, --timeout Set the mocha test-case timeout (in milliseconds). [default: 30000]
-u, --upload-doc Boolean to determine if tests that upload a doc should run. This is due to a bug with phantomjs.
-v, --browser-version The browser version to test against when using SauceLabs
--dev-build Run partial (dev) build before running tests. Tests run from coffeescript.
--full-build Run full JS build before running tests, and run tests from JS in ./build directory