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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Jean-Laurent de Morlhon
November 20, 2013
Programming
100
1
Share
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
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
220
Pourquoi Maurice ne doit surtout pas coder en Go.
jeanlaurent
0
190
Diamond Kata Workshop
jeanlaurent
0
200
Testing sur code legacy
jeanlaurent
0
140
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
67
Le fantome, le zombie et testacular Karma. Panorama des outils de tests pour application web moderne.
jeanlaurent
1
100
Other Decks in Programming
See All in Programming
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
340
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
180
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
160
NakouPAY説明用
annouim0
0
240
年間50登壇、単著出版、雑誌寄稿、Podcast出演、YouTube、CM、カンファレンス主催……全部やってみたので面白さ等を比較してみよう / I’ve tried them all, so let’s compare how interesting they are.
nrslib
4
790
Programming with a DJ Controller — not vibe coding
m_seki
3
120
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
おれのAgentic Coding 2026/03
tsukasagr
1
150
Going Multiplatform with Your Android App (Android Makers 2026)
zsmb
2
440
Kingdom of the Machine
yui_knk
2
380
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
110
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
0
320
Featured
See All Featured
The browser strikes back
jonoalderson
0
980
Mobile First: as difficult as doing things right
swwweet
225
10k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
530
Skip the Path - Find Your Career Trail
mkilby
1
110
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
800
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
270
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
170
Believing is Seeing
oripsolob
1
110
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
520
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/
?