Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start 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.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

selenium

No description
by

Jeffrey Knurek

on 16 August 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of selenium

info: Environment is 'test-native'
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'

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
CoffeeScript
Programming language that compiles to JavaScript
WebDriverJs
selenium-webdriver
Selenium's official JavaScript binding for the WebDriver server
Mocha
Test Runner
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
Hook Before/After
Before/BeforeEach to configure pre-requirements to the tests
Web Server
Which browser to test when
PhantomJs
Headless browser
Selenium
Running the stand-alone server
Grid
DriverWrapper
Object to wrap the functionality of Webdriver for the tests.
If/when changing driver module, tests don't need to be refactored

TestWrapper
Starts the app, starts a browser, starts and ends test
Test
Attempt a live demo
Basic test
Run test script
coffee ./run-tests.coffee -h
Logs
Promises to callbacks
But we want to use the same paradigm as the application code
Explicit Waits
Server time varies, so let the driver determine how long to wait
Starting the app/browser
Catch failures
CoffeeScript, Page Object Model, and WebDriverJs
Tests shouldn't know how the dom works
Inspired by languages like Ruby and Python
Makes it easy to use Object-oriented design principles in JavaScript with much less code
* admc/wd
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
JavaScript test framework runs on Node.js
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
Failure Event
Another fork to emit a failure event that the test can listen for
Future
Screen comparison (Wraith/Hukley)
Distribute more tests in parallel
dom comparison (run diff on raw html)
Performance & Monitoring
Thousand Eyes
JMeter

Jenkins
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.
BrowserStack
Self hosted
Sauce Connect
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
Take screenshot
This runs front-end tests.

Usage:

./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]


Options:
-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
Full transcript