Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Live Coding Tester une Application HTML5
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Jean-Laurent de Morlhon
November 20, 2013
Programming
1
100
Live Coding Tester une Application HTML5
Live coding Tester une Application HTML5, talk given @ Codeurs en Seine, MIX-IT
Jean-Laurent de Morlhon
November 20, 2013
Tweet
Share
More Decks by Jean-Laurent de Morlhon
See All by Jean-Laurent de Morlhon
Retour Sur DockerCon 2016 - Docker Mega Meetup
jeanlaurent
1
130
Retour sur DockerCon 2016
jeanlaurent
2
210
Pourquoi Maurice ne doit surtout pas coder en Go.
jeanlaurent
0
190
Diamond Kata Workshop
jeanlaurent
0
200
Testing sur code legacy
jeanlaurent
0
130
FruitShop
jeanlaurent
3
840
Phantom, Zombie & Karma, overview of the greatest testing tools for modern web app
jeanlaurent
5
770
Testing sur Legacy Code
jeanlaurent
1
61
Le fantome, le zombie et testacular Karma. Panorama des outils de tests pour application web moderne.
jeanlaurent
1
96
Other Decks in Programming
See All in Programming
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
220
SourceGeneratorのススメ
htkym
0
170
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
160
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.2k
CSC307 Lecture 04
javiergs
PRO
0
650
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.2k
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
220
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
dchart: charts from deck markup
ajstarks
3
980
AtCoder Conference 2025
shindannin
0
1k
今から始めるClaude Code超入門
448jp
7
7.5k
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
440
Featured
See All Featured
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
110
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
KATA
mclloyd
PRO
34
15k
Mobile First: as difficult as doing things right
swwweet
225
10k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
130
For a Future-Friendly Web
brad_frost
182
10k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
Ruling the World: When Life Gets Gamed
codingconduct
0
130
Making the Leap to Tech Lead
cromwellryan
135
9.7k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Transcript
Tester une application Live coding sur les tests d'acceptances d'une
application html5/javascript #bdd #javascript Jean-Laurent de Morlhon - mai 2013
Jean-Laurent de Morlhon Programmeur @morlhon
None
None
None
http://www.growing-object-oriented-software.com/
Projets d'aujourd'hui JavaScript CoffeeScript 8,3 Java 36,1
http://martinfowler.com/bliki/TestPyramid.html
Abbot public class LabeledListTest extends ComponentTestFixture {! ! public void
testLabelChangedOnSelectionChange() throws Throwable {! String[] contents = { "one", "two", "three" };! final LabeledList labeledList = new LabeledList(contents);! showFrame(labeledList);! ! Component list = getFinder().find(new ClassMatcher(JList.class));! JListTester tester = new JListTester();! ! JLabel label = (JLabel)getFinder().find(labeledList, new Matcher() {! public boolean matches(Component c) {! return c.getClass().equals(JLabel.class)! && c.getParent() == labeledList;! }! });! ! ! tester.actionSelectRow(list, new JListLocation(1)); ! ! assertEquals("Wrong label after selection",! "Selected: two", label.getText());! ! tester.actionSelectRow(list, new JListLocation(2));! assertEquals("Wrong label after selection",! "Selected: three", label.getText());! ! tester.actionSelectRow(list, new JListLocation(0));! assertEquals("Wrong label after selection",! "Selected: one", label.getText());! }! ! public LabeledListTest(String name) { super(name); }! ! }!
@Test! public void homePage() throws Exception {! WebClient webClient =
new WebClient();! HtmlPage page = webClient.getPage("http://www.conference-agile.fr/");! assertEquals("Agile France", page.getTitleText());! ! String pageAsXml = page.asXml();! assertTrue(pageAsXml.contains("<body itemscope"));! ! String pageAsText = page.asText();! assertTrue(pageAsText.contains("Des idées pour tout de suite!"));! ! webClient.closeAllWindows();! }! ! HtmlUnit
public class NewTest extends SeleneseTestCase {! // We create our
Selenium test case! ! public void setUp() throws Exception {! setUp("http://www.mix-it.fr/", "*firefox");! }! ! public void testNew() throws Exception {! selenium.open("/");! selenium.type("q", "rocks");! selenium.click("btnG");! ! selenium.waitForPageToLoad("30000");! ! assertTrue(selenium.isTextPresent("ROCKS !"));! }! }! Selenium
Zombie.js var Browser = require("zombie");! ! browser = new Browser();!
browser.visit("http://localhost:3000/", function () {! ! browser.fill("email", "
[email protected]
");! browser.fill("password", "youDontWantToKnow");! ! browser.pressButton("Login", function() {! assert.ok(browser.success);! assert.equal(browser.text("title"), "Welcome to Serpodile");! });! ! });!
Zombie.js Browser = require("zombie")! ! browser = new Browser()! browser.visit
"http://localhost:3000/", ->! ! browser.fill "email", "
[email protected]
"! browser.fill "password", "youDontWantToKnow"! ! browser.pressButton "Login", ->! assert.ok browser.success! assert.equal browser.text "title" , "Welcome to Serpodile"!
Cucumber Feature: Addition! In order to avoid silly mistakes! As
a math idiot ! I want to be told the sum of two numbers! ! Scenario: Add two numbers! Given I have entered 5 into the calculator! And I have entered 7 into the calculator! When I press the button! Then the result should be 12 on the screen!
Talk - Action = S**t D EM O TIM E
Références • BDD • http://referentiel.institut-agile.fr/bdd.html • Zombie.js • http://zombie.labnotes.org/ •
Cucumber.js • https://github.com/cucumber/cucumber-js • Chai.js • http://chaijs.com/
Alternatives http://karma-runner.github.io http://dalekjs.com/ http://casperjs.org/ https://github.com/FluentLenium FluentLenium
Source & Slides https://github.com/jeanlaurent/CucumberAndZombie
Pour aller plus loin • UI Test • Karma: http://karma-runner.github.io
• Casper.js: http://casperjs.org/ • FluentLenium: https://github.com/ FluentLenium/ • Unit Testing • Jasmine: https://github.com/pivotal/jasmine • Buster.js : http://docs.busterjs.org/en/latest/ • Mocha : https://github.com/visionmedia/mocha • QUnit : http://qunitjs.com/ • Sinon.js: http://sinonjs.org/
?