17
navigation scripting & testing utilit antomJS and SlimerJS written in Javasc CasperJs. A Andriana K

casperjs presentation

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: casperjs presentation

is a navigation scripting & testing utility for PhantomJS and SlimerJS written in Javascript

CasperJs.A Andriana K

Page 2: casperjs presentation

Why using casperjs ?Scripting a browsing workflow using Javascript is painfully hard if you intend to use chained callbacks. This kind of code is a nightmare to write, to read, to understand and to maintain:

Page 3: casperjs presentation

l Well, CasperJS solves this kind of problem using a convenient APIl for dealing with asynchronous stuff:

API docummentation

Page 4: casperjs presentation

Simulate UI testing.

Page 5: casperjs presentation

What is PhantomJS?

PhantomJS is a headless WebKit with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selectors, JSON, Canvas and SVG.

Page 6: casperjs presentation

Capturing screenshotsl Capturing a screenshot of a given area is as easy as this:

Page 7: casperjs presentation

Creating navigation scenarios

l Want to simulate the user navigation as if he were clicking through links?l No problem:

Page 8: casperjs presentation

Filling and handling forms

l Filling and submitting a form is not much harder:

Page 9: casperjs presentation

Asynchronous rendering of page

l Sometimes (ok, often), lots of stuff is loaded asynchronously throughl Ajax or any other fancy invention of the Devil. You can just wait for it to happen:

Page 10: casperjs presentation

Testingl Now all of this is fancy, but the true powers of CasperJS come from its functional testingl capabilities. For example, testing google search can be done that way :

Page 11: casperjs presentation

Running the suite would produce this shiny colored output:

Page 12: casperjs presentation

Implementation for digaku2l For all page

Page 13: casperjs presentation

Output :

Page 14: casperjs presentation
Page 15: casperjs presentation

Problem in digaku2 UI testing

Page 16: casperjs presentation

InferenceUsing casperjs more easy & powerfull than javascript, because casperjs directly call the API of the library

API docummentation

Installation

Page 17: casperjs presentation

Thank you... :D