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 .

More Related Content

What's hot (20)

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

Viewers also liked (7)

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

Recently uploaded (20)

PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Digital Circuits, important subject in CS
contactparinay1
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
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 .