A Introduction to the World of Node, Javascript & Selenium

Post on 05-Aug-2015

285 views 1 download

transcript

BE A COOL KIDwrite selenium in Node.JS

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.

seleniumconf.org

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

nodejs.org

+ =

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

iojs.org

+ =+

=foundation

+

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

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

NODE PACKAGE MANGER

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

NODE PACKAGE MANGERpackage.json

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

npm install <package_name>

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/

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/

SO MANY CHOICES FOR SELENIUM & JAVASCRIPT

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

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

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.

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

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

ASYNCHRONOUS

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

ASYNCHRONOUS

the answer

THE CALLBACK

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

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

THE PROMISE

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

THANK YOU

@jameseisenhauer