SlideShare a Scribd company logo
TESTING METEOR USING
CASPER.JS

A presentation by Stephan Hochhaus ( @yauh ) on Dec, 16th 2013.
Testing MeteorJS using CasperJS
PUT YOUR APP TO THE TEST
Functional tests focus on user experience and ensure features
are working as expected (i.e. find bugs). Also they reveal
problems with your requirements.
Testing MeteorJS using CasperJS
CHALLENGES IN TESTING DYNAMIC WEB
APPS
DOM is not ready on initial load
site elements are constantly changing
elements without proper IDs are hard to address and make
testing less robust
timing of steps is critical to successful testing
Testing MeteorJS using CasperJS
WHAT IS IT?
Casper is both a testing & navigation framework
It is based on PhantomJS
You can easily create Jenkins Compatible JUnit XML
CASPER CAN BE USED TO
1. automate your browser to scrape stuff
2. test sites and apps (which is what we're talking about here)
(It just does, but that's not the topic of this presentation.)
Testing MeteorJS using CasperJS
HOW TO USE CASPER
Grab PhantomJS
Grab Casper version 1.1 (devel)
Find a running Meteor app
Write some tests
IF YOU ARE ON OS X

INSTALL CASPERJS + PHANTOMJS USING HOMEBREW
$ brew install casperjs --devel

RUNNING A TEST
$ casperjs test mytest.js
REMEMBER THESE?
In order to have a consistent basis for testing we'll make use of
some example apps provided by Meteor:
Todos
Parties
CHEAT SHEETS
Some ressources to help you understand
Infos about XPath
Testing MeteorJS using CasperJS
A CASPER SKELETON
var meteorUrl = 'http://localhost:3000/';
// Start your testing
casper.start(meteorUrl, function() {
this.test.assertTitle('Todos', 'App title is as expected');
this.test.comment('Taking a picture to document our success');
this.capture('captures/a-website.png');
casper.then(function() {
// do something else
});
});
// don't forget to run your tests
casper.run();
LOOK AT OUR CAPTURE
HANDS ON

LET'S TEST THE EXAMPLES
Gentle introduction - simpletest.js
Basic functionality - todotest.js
Logging in and setting up a party - partiestest.js
Testing MeteorJS using CasperJS
CONSIDER YOUR CHOICES
Dalek.js 0.0.8
Zombie.js 2.0.0-alpha24
Selenium 2.4.0
Laika 0.3.1
Mocha 1.15.1
RTD - The Meteor Test Runner
Testing MeteorJS using CasperJS
THANK YOU!

I blog at yauh.de , tweet as @yauh , and +1 as StephanHochhaus .
Feel free to fork this .
Ad

Recommended

CasperJs Enjoy Functional Testing
CasperJs Enjoy Functional Testing
Fabien POMEROL
 
Superfast Automated Web Testing with CasperJS & PhantomJS
Superfast Automated Web Testing with CasperJS & PhantomJS
Hervé Vũ Roussel
 
Site Testing with CasperJS
Site Testing with CasperJS
Joseph Scott
 
CasperJS and PhantomJS for Automated Testing
CasperJS and PhantomJS for Automated Testing
X-Team
 
CasperJS
CasperJS
LearningTech
 
Angular2 ecosystem
Angular2 ecosystem
Kamil Lelonek
 
Vagrant plugin development intro
Vagrant plugin development intro
Budh Ram Gurung
 
Nodejs Intro Part One
Nodejs Intro Part One
Budh Ram Gurung
 
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web Applications
Budh Ram Gurung
 
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Rob Friesel
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
NodeJS: n00b no more
NodeJS: n00b no more
Ben Peachey
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
Frank Rousseau
 
Write php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
Automating Front-End Workflow
Automating Front-End Workflow
Dimitris Tsironis
 
Frontend at Scale - The Tumblr Story
Frontend at Scale - The Tumblr Story
Chris Miller
 
Getting Started with Ansible
Getting Started with Ansible
Ahmed AbouZaid
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginx
roskakori
 
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
John Anderson
 
CSS Regression Tests
CSS Regression Tests
Kaloyan Kosev
 
Node.jsやってみた
Node.jsやってみた
Yoshihiko Uchida
 
Windows Azure loves OSS
Windows Azure loves OSS
Kazumi Hirose
 
Jenkins and Groovy
Jenkins and Groovy
Kiyotaka Oku
 
CoffeeScript in 5mins
CoffeeScript in 5mins
Masakuni Kato
 
Node.js Cloud deployment
Node.js Cloud deployment
Nicholas McClay
 
A few good JavaScript development tools
A few good JavaScript development tools
Simon Kim
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
DK Lee
 
Write php deploy everywhere tek11
Write php deploy everywhere tek11
Michelangelo van Dam
 
LaTeX für Geisteswissenschaftler
LaTeX für Geisteswissenschaftler
Stephan Hochhaus
 
Walk of Claim - A Meteor Meetup presentation
Walk of Claim - A Meteor Meetup presentation
Stephan Hochhaus
 

More Related Content

What's hot (20)

Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web Applications
Budh Ram Gurung
 
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Rob Friesel
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
NodeJS: n00b no more
NodeJS: n00b no more
Ben Peachey
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
Frank Rousseau
 
Write php deploy everywhere
Write php deploy everywhere
Michelangelo van Dam
 
Automating Front-End Workflow
Automating Front-End Workflow
Dimitris Tsironis
 
Frontend at Scale - The Tumblr Story
Frontend at Scale - The Tumblr Story
Chris Miller
 
Getting Started with Ansible
Getting Started with Ansible
Ahmed AbouZaid
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginx
roskakori
 
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
John Anderson
 
CSS Regression Tests
CSS Regression Tests
Kaloyan Kosev
 
Node.jsやってみた
Node.jsやってみた
Yoshihiko Uchida
 
Windows Azure loves OSS
Windows Azure loves OSS
Kazumi Hirose
 
Jenkins and Groovy
Jenkins and Groovy
Kiyotaka Oku
 
CoffeeScript in 5mins
CoffeeScript in 5mins
Masakuni Kato
 
Node.js Cloud deployment
Node.js Cloud deployment
Nicholas McClay
 
A few good JavaScript development tools
A few good JavaScript development tools
Simon Kim
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
DK Lee
 
Write php deploy everywhere tek11
Write php deploy everywhere tek11
Michelangelo van Dam
 
Nodejs Intro - Part2 Introduction to Web Applications
Nodejs Intro - Part2 Introduction to Web Applications
Budh Ram Gurung
 
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Rob Friesel
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
NodeJS: n00b no more
NodeJS: n00b no more
Ben Peachey
 
Haibu: dev deployment is fast and easy again
Haibu: dev deployment is fast and easy again
Frank Rousseau
 
Automating Front-End Workflow
Automating Front-End Workflow
Dimitris Tsironis
 
Frontend at Scale - The Tumblr Story
Frontend at Scale - The Tumblr Story
Chris Miller
 
Getting Started with Ansible
Getting Started with Ansible
Ahmed AbouZaid
 
Multiple django applications on a single server with nginx
Multiple django applications on a single server with nginx
roskakori
 
The Peanut Butter Cup of Web-dev: Plack and single page web apps
The Peanut Butter Cup of Web-dev: Plack and single page web apps
John Anderson
 
CSS Regression Tests
CSS Regression Tests
Kaloyan Kosev
 
Windows Azure loves OSS
Windows Azure loves OSS
Kazumi Hirose
 
Jenkins and Groovy
Jenkins and Groovy
Kiyotaka Oku
 
CoffeeScript in 5mins
CoffeeScript in 5mins
Masakuni Kato
 
Node.js Cloud deployment
Node.js Cloud deployment
Nicholas McClay
 
A few good JavaScript development tools
A few good JavaScript development tools
Simon Kim
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
DK Lee
 

Viewers also liked (7)

LaTeX für Geisteswissenschaftler
LaTeX für Geisteswissenschaftler
Stephan Hochhaus
 
Walk of Claim - A Meteor Meetup presentation
Walk of Claim - A Meteor Meetup presentation
Stephan Hochhaus
 
Writing (Meteor) Code With Style
Writing (Meteor) Code With Style
Stephan Hochhaus
 
Meteor - not just for rockstars
Meteor - not just for rockstars
Stephan Hochhaus
 
Introduction to Meteor - revised edition
Introduction to Meteor - revised edition
Stephan Hochhaus
 
Meteor WWNRW Intro
Meteor WWNRW Intro
Stephan Hochhaus
 
Automatisierte infrastruktur mit ansible
Automatisierte infrastruktur mit ansible
Stephan Hochhaus
 
LaTeX für Geisteswissenschaftler
LaTeX für Geisteswissenschaftler
Stephan Hochhaus
 
Walk of Claim - A Meteor Meetup presentation
Walk of Claim - A Meteor Meetup presentation
Stephan Hochhaus
 
Writing (Meteor) Code With Style
Writing (Meteor) Code With Style
Stephan Hochhaus
 
Meteor - not just for rockstars
Meteor - not just for rockstars
Stephan Hochhaus
 
Introduction to Meteor - revised edition
Introduction to Meteor - revised edition
Stephan Hochhaus
 
Automatisierte infrastruktur mit ansible
Automatisierte infrastruktur mit ansible
Stephan Hochhaus
 
Ad

Recently uploaded (20)

9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Seminar: Targeting Trust: The Future of Identity in the Workforce.pptx
FIDO Alliance
 
Ad

Testing MeteorJS using CasperJS

  • 1. TESTING METEOR USING CASPER.JS A presentation by Stephan Hochhaus ( @yauh ) on Dec, 16th 2013.
  • 3. PUT YOUR APP TO THE TEST Functional tests focus on user experience and ensure features are working as expected (i.e. find bugs). Also they reveal problems with your requirements.
  • 5. CHALLENGES IN TESTING DYNAMIC WEB APPS DOM is not ready on initial load site elements are constantly changing elements without proper IDs are hard to address and make testing less robust timing of steps is critical to successful testing
  • 7. WHAT IS IT? Casper is both a testing & navigation framework It is based on PhantomJS You can easily create Jenkins Compatible JUnit XML
  • 8. CASPER CAN BE USED TO 1. automate your browser to scrape stuff 2. test sites and apps (which is what we're talking about here)
  • 9. (It just does, but that's not the topic of this presentation.)
  • 11. HOW TO USE CASPER Grab PhantomJS Grab Casper version 1.1 (devel) Find a running Meteor app Write some tests
  • 12. IF YOU ARE ON OS X INSTALL CASPERJS + PHANTOMJS USING HOMEBREW $ brew install casperjs --devel RUNNING A TEST $ casperjs test mytest.js
  • 13. REMEMBER THESE? In order to have a consistent basis for testing we'll make use of some example apps provided by Meteor: Todos Parties
  • 14. CHEAT SHEETS Some ressources to help you understand Infos about XPath
  • 16. A CASPER SKELETON var meteorUrl = 'http://localhost:3000/'; // Start your testing casper.start(meteorUrl, function() { this.test.assertTitle('Todos', 'App title is as expected'); this.test.comment('Taking a picture to document our success'); this.capture('captures/a-website.png'); casper.then(function() { // do something else }); }); // don't forget to run your tests casper.run();
  • 17. LOOK AT OUR CAPTURE
  • 18. HANDS ON LET'S TEST THE EXAMPLES Gentle introduction - simpletest.js Basic functionality - todotest.js Logging in and setting up a party - partiestest.js
  • 20. CONSIDER YOUR CHOICES Dalek.js 0.0.8 Zombie.js 2.0.0-alpha24 Selenium 2.4.0 Laika 0.3.1 Mocha 1.15.1 RTD - The Meteor Test Runner
  • 22. THANK YOU! I blog at yauh.de , tweet as @yauh , and +1 as StephanHochhaus . Feel free to fork this .