Culerity - Headless full stack testing for JavaScript

Post on 13-May-2015

2984 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

This is a presentation i gave at the Java Script User group (twitter.com/berlinjs). It is about testing your entire web application including javascript without opening a browser for that.

Transcript

CulerityHeadless Fullstack Testing for Web

Applications

see github.com/langalex/culerity

Look How ’s talking!

Thilo with a H!

github.com/thilo

1st Thursday every Month, rug-b.de

coworking-space, co-up.de

UPSTREAM

my company, upstre.am

we done lot of web appsour own latest product: co-bot.me

Done all apps test driven

Problem

we have unit tests for all our code.And some integration tests.But....

Does it work as a whole?

All the bits and pieces fit together?I could test manuallyIt is CumbersomeBetter Automate it too, we are developers

2 Flavors

In Browserrun your test in an actual browser by scripting it

Headlesssome software only "Browser"

Properties of Headless Testing

Consistent Behavior

Direct API for Interaction

Enter Culerity

First solution to test web apps full-stack including Javascript with ruby

The Components

(Cucumber)

Culerity

Celerity

HtmlUnit

Rhino

culerity is just a part, but an important one

written in ruby

PlainText Acceptance Test

Uses a human readable DSL to specify test cases

Matched agains Test Steps

each line is matched against a step which implements logicsteps include, setup (Given), interaction (When), assertions (Then)

Culerity

mostly rubysmall part runs in Jruby

Proxy Library

Interaction - Low Level

can be used without webrat.

Can get complicated!finding a link either by text, id, title or partial matching text

Cucumber Steps that uses the Proxy

provides easy cucumber steps that wraps interaction

Celerity

in Jruby

Api Wrapper for HTML Unit

HtmlUnit

pure Jave

GUI-Less browser

so no fancy gui to show here

simulates browser behavior of Firefox2, Firefox3 or IE

Rhino

JavaScript implementation in Java

part of html that does the javascript

How it fits togetherCulerity

CelerityServer

HTMLUnit

BrowserProxyObjectProxy

CelerityBrowser

Above line ruby, below Jruby1. Culerity starts Celerity Server as a Subprocess in Jruby - Serialize back end forth Calls through STDIN and STDOUT2. Browser Proxy object controls a Celerity Browser instance3. ObjectProxies are created for non literal Results when interacting with the celerity browser

Action

see code at github.com/thilo/culerity_talk_src

Shortcomings

• Dynamic Changes only on element level (wrapping div)

• Blocks have no access to context

• HTMLUnit Bugs

• Extra Process

The Future is Now!Some other solutions with improvements- Only one Test Process with Ruby Java Bridge - Steam- Mutli Backends - With Capybara- Javascript Only Dom Enviroment on Rhino - Env-Js (since 2007)

Thanks!

Questions ?

Credits• http://www.flickr.com/photos/montyhood/4414773547/

• jruby.org

• ruby.org

• http://www.mozilla.org/rhino/

• http://hubblesite.org/gallery/album/entire/pr2001025a/

• FF, IE, Java Logo from wikipedia

• Rug-B Logo Copyright by Nico Hagenburger

• Cucumber Logo from cukes.info by Gideon Bullock

top related