a introduction to the world of node, javascript & selenium

26
BE A COOL KID write selenium in Node.JS

Upload: james-eisenhauer

Post on 05-Aug-2015

285 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: A Introduction to the World of Node, Javascript & Selenium

BE A COOL KIDwrite selenium in Node.JS

Page 2: A Introduction to the World of Node, Javascript & Selenium

http://www.oscon.com/

Open source software, architecture, frameworks, and tools for today’s engineers

If software is what you do, OSCON is where you want to be (4,182 +/- software engineers each year can’t be

wrong). Meet the full stack, face to face.

Page 3: A Introduction to the World of Node, Javascript & Selenium
Page 4: A Introduction to the World of Node, Javascript & Selenium
Page 5: A Introduction to the World of Node, Javascript & Selenium

seleniumconf.org

Page 6: A Introduction to the World of Node, Javascript & Selenium

WHAT IS NODE.JS?simply it is server side javascript

nodejs.org

+ =

Page 7: A Introduction to the World of Node, Javascript & Selenium

WHAT IS IO.JS?don’t piss of the community

iojs.org

+ =+

=foundation

+

Page 8: A Introduction to the World of Node, Javascript & Selenium

ES6 IS COMING LIKE WINTERkangax.github.io/compat-table/es6/

Page 9: A Introduction to the World of Node, Javascript & Selenium

INSTALLING NODEUse Node Version Manger you can thank me later https://github.com/creationix/nvm

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash

nvm install iojsnvm install 0.10nvm use 0.10

Page 10: A Introduction to the World of Node, Javascript & Selenium

NODE PACKAGE MANGER

NPM installed with Node.jshttps://www.npmjs.com/Manage your package dependencies & a little bit more

Page 11: A Introduction to the World of Node, Javascript & Selenium

NODE PACKAGE MANGERpackage.json

npm install will install everything in the package.json file.

npm install <package_name>

Page 12: A Introduction to the World of Node, Javascript & Selenium

GULP & GRUNTBUILD TOOLS

The cool kids use gulp, it is newer and shiny. Gulp streams file generation instead of writing temp copies.Gulp is much faster, Grunt has more plugins

http://gruntjs.com/http://gulpjs.com/

Page 13: A Introduction to the World of Node, Javascript & Selenium

JASMINE & MOCHATEST FRAMEWORKS

Holy war like JUnit and TestNG

Jasmine is older, more documentation and has mocking and assertions built in Mocha is newer and lets you choose what mocking and assertions libraries you want

http://jasmine.github.io/ http://mochajs.org/

Page 14: A Introduction to the World of Node, Javascript & Selenium

SO MANY CHOICES FOR SELENIUM & JAVASCRIPT

Page 15: A Introduction to the World of Node, Javascript & Selenium

WEBDRIVER.JShttps://code.google.com/p/selenium/wiki/WebDriverJs

Official Selenium Project Javascript bindingsMost downloaded selenium packageDifficult to find online community supportProject Lead - Jason Leyba - California - Google

Late to the party - don’t get confused with Webdriver.JS that is now Webdriver.io

Page 16: A Introduction to the World of Node, Javascript & Selenium

WEBDRIVER.IO

http://webdriver.io/Has the coolest logo!Started before Selenium Project javascript bindings and was called webdrver.js

Awesome documentation!Nice frameworkProject Lead - Christian Bromann - Berlin - Sauce Labs

Page 17: A Introduction to the World of Node, Javascript & Selenium

WD.JS

http://admc.io/wd/ Framework Appium project uses for testing AppiumProject Lead - Adam Christian - California - Sauce LabsA little obscure, mostly developed specifically for Adam’s and few others needs.

Page 18: A Introduction to the World of Node, Javascript & Selenium

NIGHTWATCH.JS

http://nightwatchjs.org/The simplest to get up and runningIncludes test runner, test framework and assertion frameworkGood Documentation and CommunityTest framework limited functionality compared to Mocha & Jasmine

Project Lead - Andrei Rusu - Norway - Confirmit

Page 19: A Introduction to the World of Node, Javascript & Selenium

PROTRACTOR.JShttps://angular.github.io/protractor/#/ Wrapper around webdriver.jsBest community!Project Lead - Julie Ralph - Washington - GoogleMainly created for AngularJS apps and has ability to know AngularJS app stateCan be used with non-angular sites, simple config change Best built in parallel running ability

Page 20: A Introduction to the World of Node, Javascript & Selenium

ASYNCHRONOUS

If you are not use to programming asynchronously that can be a challenge to get use to

Page 21: A Introduction to the World of Node, Javascript & Selenium

ASYNCHRONOUS

the answer

Page 22: A Introduction to the World of Node, Javascript & Selenium

THE CALLBACK

Page 23: A Introduction to the World of Node, Javascript & Selenium

CALLBACK HELLasync1(function(input, result1) { async2(function(result2) { async3(function(result3) { async4(function(result4) { async5(function(output) { // do something with output }); }); }); });})

Page 24: A Introduction to the World of Node, Javascript & Selenium

THE PROMISE A promise is an object that represents a value, or the eventual computation of a valuePromises save you from callback hellPromises make it easier to read codePromises come with ES6 You can also use libraries like Q https://github.com/kriskowal/q with older versions of node.js

Page 25: A Introduction to the World of Node, Javascript & Selenium

THE PROMISE

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

Page 26: A Introduction to the World of Node, Javascript & Selenium

THANK YOU

@jameseisenhauer