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

PDF
CasperJs Enjoy Functional Testing
PDF
Superfast Automated Web Testing with CasperJS & PhantomJS
PDF
Site Testing with CasperJS
PDF
CasperJS and PhantomJS for Automated Testing
PPTX
CasperJS
PDF
Angular2 ecosystem
PDF
Vagrant plugin development intro
PPT
Nodejs Intro Part One
CasperJs Enjoy Functional Testing
Superfast Automated Web Testing with CasperJS & PhantomJS
Site Testing with CasperJS
CasperJS and PhantomJS for Automated Testing
CasperJS
Angular2 ecosystem
Vagrant plugin development intro
Nodejs Intro Part One

What's hot (20)

ODP
Nodejs Intro - Part2 Introduction to Web Applications
KEY
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
PDF
Profiling PHP with Xdebug / Webgrind
PDF
NodeJS: n00b no more
PDF
Haibu: dev deployment is fast and easy again
KEY
Write php deploy everywhere
PDF
Automating Front-End Workflow
PDF
Frontend at Scale - The Tumblr Story
PDF
Getting Started with Ansible
PDF
Multiple django applications on a single server with nginx
PDF
The Peanut Butter Cup of Web-dev: Plack and single page web apps
PPTX
CSS Regression Tests
PDF
Node.jsやってみた
PPTX
Windows Azure loves OSS
PDF
Jenkins and Groovy
PDF
CoffeeScript in 5mins
PPT
Node.js Cloud deployment
PPTX
A few good JavaScript development tools
PDF
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
PDF
Write php deploy everywhere tek11
Nodejs Intro - Part2 Introduction to Web Applications
Like a Genie from a Lamp: Headless JavaScript Unit Testing with Jasmine and P...
Profiling PHP with Xdebug / Webgrind
NodeJS: n00b no more
Haibu: dev deployment is fast and easy again
Write php deploy everywhere
Automating Front-End Workflow
Frontend at Scale - The Tumblr Story
Getting Started with Ansible
Multiple django applications on a single server with nginx
The Peanut Butter Cup of Web-dev: Plack and single page web apps
CSS Regression Tests
Node.jsやってみた
Windows Azure loves OSS
Jenkins and Groovy
CoffeeScript in 5mins
Node.js Cloud deployment
A few good JavaScript development tools
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
Write php deploy everywhere tek11
Ad

Viewers also liked (7)

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

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Spectroscopy.pptx food analysis technology
PDF
cuic standard and advanced reporting.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Approach and Philosophy of On baking technology
PDF
KodekX | Application Modernization Development
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Encapsulation theory and applications.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectroscopy.pptx food analysis technology
cuic standard and advanced reporting.pdf
Programs and apps: productivity, graphics, security and other tools
Approach and Philosophy of On baking technology
KodekX | Application Modernization Development
MIND Revenue Release Quarter 2 2025 Press Release
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Network Security Unit 5.pdf for BCA BBA.
Encapsulation_ Review paper, used for researhc scholars
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Understanding_Digital_Forensics_Presentation.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Encapsulation theory and applications.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Chapter 3 Spatial Domain Image Processing.pdf

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 .