javascript testing iad2010

Post on 06-May-2015

1.080 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Italian Agile Day 2010 Presentation about Javascript testing

TRANSCRIPT

The secret art of Agile Javascripting

Luca Grulla

Italian Agile Day, Genova, 19/11/10

Our background

Large public facing websitesSignificant javascript codebasewith complex DOM interactionHeavy use of Ajax Large amount of business logic

Long life expectancy

Disclaimer

This presentation is technology agnosticEach tool used is replaceableIt is not about how to use jQuery

Technology Stack• JQuery• JSTestDriver• Ewloe• JavascriptLint

It used to be so simple…

Rich clients

We want unit tests

Scenario

Login formNeed to validate user credentialsNeed to execute a server call via ajax POSTBased on the result we need to show a

welcome or an error message

So what is wrong with this code ?

We want to test it!

Domain abstraction

Abstraction around integration points

HTTP

DOMPresentation Logic

Business Logic

Our approachJavascript is a first class language

create abstractions:business logicpresentation logicintegrations…but not limited to a specific pattern !!

Keep your presentation logic class as skinny as possible in order to express intents

Favour interaction tests over integration tests

Tools Considerations

….whatever you like but has to be pluggable in your Continuous Integration !!

Questions ?

Thank You !

Luca Grulla luca.grulla@thoughtworks.comhttp://www.lucagrulla.it/bloghttp://www.github.com/lucagrulla

References

Ewloe http://github.com/gurrie/ewloe

top related