SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
d dkdevelopment
kommunikation
design
Welcome
Peter Foerger, Senior Developer
@bauschan
Agenda
Agenda Part 1
Introduction
Vagrant Box / Trello Accounts
Install NodeJS - Caveats / Best Practises
Install DalekJS
Run firsts test
Documentation
Trello Board Issues
BREAK ~10 min
Agenda Part 2
Work on the issues
Code Reviews
Integrate tests on CI Server
The fun stuff
Grunt plugin
Remote Testing / Run tests in the cloud
Debugging
CI/CD

DalekJS

Why?
Relies on Standards - WebDriver/JSON-Wire
Only dependency in Node.js
Abstraction layer for PhantomJS

with a testing API on top
Writing tests feels natural
DalekJS

Caveats
Webfonts (Phantom JS Issue)
Mouse Events - TBA
*.js only on *nix systems
Error handling - TBA
setUp/tearDown - TBA
No HTTP Status Codes
Vagrant
Base Box
Requirements
!
Vagrant 1.6.x
VirtualBox 4.3x
Installation

Vagrant VM
Add the dalekjs base box
Initialize Vagrant
Adapt Vagrantfile
Start the Box
Installation Vagrant Box
Requirements
VirtualBox 4.3.x
Vagrant ~> 1.0.x preferably 1.6.3

Installation
Copy dalekjs.box‘ from Fileserver
Add it as a base box:

$ vagrant box add dalekjs /path/to/the/dalekjs.box
Installation Vagrant Box
Installation
Initialize the dalek box

$ vagrant init dalekjs!
Enable the GUI

$ vi Vagrantfile



Uncomment the VirtualBox configuration!
Start the VM

$ vagrant up
Installation

Node.js/DalekJS
Recommendation for

Ubuntu 12.04 LTS
Installation Node.js
Add repository / install package
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
!
Set local node prefix
echo prefix = ~/.node >> ~/.npmrc
echo 'export PATH=$HOME/.node/bin:$PATH' >> ~/.bashrc 
. ~/.bashrc
!
Verify that everything’s in place
node -v 
 
 // v0.10.28
npm -v 
 
 // 1.4.9
Installation DalekJS
Create a directory and cd into
Create a package.json file

{
"name": "t3ddDalekJS",
"description": "Tests for typo3.org",
"version": "0.0.1"
}
!
$ npm install dalek-cli -g
$ npm install dalekjs --save-dev
DalekJS

Overview
Assertions / Actions
Phantom JS /Chrome/IE/Firefox/Safari Mobil
Screenshots
Resize Window
Execute Javascript
Driver Webdriver/ Sauce Labs
Grunt

Javascript Taskrunner

used for automation & more

grunt -dalek
Inside projects folder

$ npm install grunt-dalek --save-dev
!
Gruntfile.js
grunt.loadNpmTasks('grunt-dalek');!
grunt -dalek
Example Configuration

grunt.initConfig({
dalek: {!
dist: {!
src: ['test/example/test-github.js']!
}!
}!
!
});!
!
/**!
* Loads tasks located in the tasks directory.!
*/!
grunt.loadTasks('tasks');!
!
grunt.registerTask('default', ['dalek']);!
SauceLabs

Dalek driver

Run your tests within the sauce cloud

Driver SauceLabs
Installation
$ npm install dalek-driver-sauce --save-dev!


Dalekfile.json


{!
! "driver": ["sauce"],!
! "driver.sauce": {!
! ! "user": "peter_foerger",!
! ! "key": „yourSauceLabsKey"!
! },!
…!
Driver SauceLabs
"browsers": [{!
! ! "iphone": {!
! ! ! "platform": "Mac 10.6",!
! ! ! "actAs": "iphone",!
! ! ! "browserName": "iphone",!
! ! ! "version": 5!
! ! },!
! ! "android": {!
! ! ! "platform": "Linux",!
! ! ! "actAs": "android",!
! ! ! "version": 4.3!
! ! }!
! }],!
! "browser": ["iphone"]!
Taking
Screenshots

DalekJS -> PhantomJS
Screenshots
!
!
!
// creates 'my/folder/my_file.png'!
test.screenshot(‚my/folder/my_file');!
!
// creates 'my/page/in/safari/homepage.png'!
test.screenshot(‚my/page/in/:browser/homepage');!
!
// creates 'my/page/in/safari_6_0_1/homepage.png'!
test.screenshot(‚my/page/in/:browser_:version/homepage');!
!
// creates 'my/page/in/safari_6_0_1/on/osx/homepage.png'!
test.screenshot('my/page/in/:browser_:version/on/:os/homepage');!
!
CI/CD

Jenkins
Travis
CI/CD
Jenkins
!
Junit reporter
$ npm install dalek-reporter-junit —save-dev
$ dalek your_test.js -r console,junit



!
!
!
!
CI/CD
Travis CI


.travis.yml

language: node_js!
node_js:!
- "0.10"!
before_script:!
- npm install -g dalek-cli!
after_script:!
- dalek test/*.js
Remote testing

Test against remote machines
Remote Server
dalek —remote

Remote connection is ready on IP: 10.1.3.3:9020
!
Local Machine
{!
! "browsers": [{!
! ! "ieWin": {!
! ! ! "actAs": "ie",!
! ! ! "type": "remote",!
! ! ! "host": "10.1.3.3",!
! ! ! "port": "9020"!
! ! }!
! }]!
}!
Test against remote machines
Run your test
!
$ dalek tests/exists.js -b ieWin!
!
!
!
!
CI/CD
Travis CI


.travis.yml

language: node_js!
node_js:!
- "0.10"!
before_script:!
- npm install -g dalek-cli!
after_script:!
- dalek test/*.js
Debugging

Outputting debugging information
Node’s built-in debugger
Node Inspector
PHPStorm Node’s debugger
Debugging Node.js
Console Module
!
// Arguments can be printf()-style:
console.log('Counter: %d', counter);
!
// Warnings and Errors
node server.js 2> error.log



// Object contents

console.dir(myObject);



// Stacktrace

console.trace();
Debugging Node.js
Built-in debugger
!
Call node with the ‚debug‘ keyword
node debug someFile.js!
!
Statement ‚debugger‘
http.createServer(function (req, res) {!
debugger;!
handleRequest(req, res);!
}).listen(1337, '127.0.0.1');!
!
Debugging Node.js
REPL- examining the current state
Watchers
watch("my_expression")!
!
watchers // prints active watchers!
!
unwatch("my_expression")!
!
!
Debugging Node.js
Stepping
cont, c - Continue execution
next, n - Step next
step, s - Step in
out, o - Step out
pause - Pause running code (like pause button in
Developer Tools)
!
Debugging Node.js
Breakpoints
setBreakpoint(), sb() - Set breakpoint on current
line
setBreakpoint(line), sb(line) - Set breakpoint on
specific line
setBreakpoint('fn()'), sb(...) - Set breakpoint on a
first statement in functions body
setBreakpoint('script.js', 1), sb(...) - Set breakpoint
on first line of script.js
Node Inspector
Installation

$ npm install -g node-inspector
Run app in debug mode

$ node --debug-brk myApp.js
Start Node Inspector

$ node-inspector
Open a WebKit Browser

http://127.0.0.1:8080/debug?port=5858
!
!
PhpStorm Node Debugger
Further
Readings
http://dalekjs.com/pages/documentation.html
https://saucelabs.com
https://github.com/node-inspector/node-inspector
https://wiki.jenkins-ci.org/display/JENKINS/HTML
+Publisher+Plugin
http://gruntjs.com/
d dkdevelopment
kommunikation
design
thank you.

Contenu connexe

Tendances

SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
Ngoc Dao
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
偉格 高
 

Tendances (20)

Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsCool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
 
SockJS Intro
SockJS IntroSockJS Intro
SockJS Intro
 
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Module, AMD, RequireJS
Module, AMD, RequireJSModule, AMD, RequireJS
Module, AMD, RequireJS
 
Understanding the Node.js Platform
Understanding the Node.js PlatformUnderstanding the Node.js Platform
Understanding the Node.js Platform
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Node.js debugging
Node.js debuggingNode.js debugging
Node.js debugging
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
 
Node js
Node jsNode js
Node js
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
 
SVN essentials
SVN essentialsSVN essentials
SVN essentials
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
 
Node.js Crash Course
Node.js Crash CourseNode.js Crash Course
Node.js Crash Course
 
Acceptance tests
Acceptance testsAcceptance tests
Acceptance tests
 
Node.js Cloud deployment
Node.js Cloud deploymentNode.js Cloud deployment
Node.js Cloud deployment
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 

Similaire à DalekJS Workshop at T3DD14

Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
Ortus Solutions, Corp
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
Tom Croucher
 

Similaire à DalekJS Workshop at T3DD14 (20)

Tribal Nova Docker workshop
Tribal Nova Docker workshopTribal Nova Docker workshop
Tribal Nova Docker workshop
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
Trust, but verify | Testing with Docker Containers
Trust, but verify | Testing with Docker ContainersTrust, but verify | Testing with Docker Containers
Trust, but verify | Testing with Docker Containers
 
The Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build ScriptThe Fairy Tale of the One Command Build Script
The Fairy Tale of the One Command Build Script
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Pluralsight Webinar: Simplify Your Project Builds with Docker
Pluralsight Webinar: Simplify Your Project Builds with DockerPluralsight Webinar: Simplify Your Project Builds with Docker
Pluralsight Webinar: Simplify Your Project Builds with Docker
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
ILM - Pipeline in the cloud
ILM - Pipeline in the cloudILM - Pipeline in the cloud
ILM - Pipeline in the cloud
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
Troubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support EngineerTroubleshooting Tips from a Docker Support Engineer
Troubleshooting Tips from a Docker Support Engineer
 
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, DockerTroubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
Troubleshooting Tips from a Docker Support Engineer - Jeff Anderson, Docker
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
RichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile DevicesRichFaces - Testing on Mobile Devices
RichFaces - Testing on Mobile Devices
 

Dernier

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Dernier (20)

WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

DalekJS Workshop at T3DD14