Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
JavaScript Testing and Continuous Integration
Search
Mats Bryntse
March 18, 2015
Technology
220
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScript Testing and Continuous Integration
jDays 2015
Mats Bryntse
March 18, 2015
More Decks by Mats Bryntse
See All by Mats Bryntse
Expect the unexpected - How to deal with JavaScript errors in web applications
mats
1
130
Creating Reusable UI Components with Ext JS
mats
2
1.1k
Dealing with javascript errors in SPAs
mats
0
200
Record.Replay.Reproduce
mats
0
190
Expect the unexpected
mats
0
520
Record.Replay.Reproduce - Dealing with JS errors in modern web apps
mats
0
590
Unit and UI Testing Your Ext JS Web Applications with Siesta
mats
0
260
Siesta Deep Dive
mats
0
380
Testing SalesForce A
mats
0
120
Other Decks in Technology
See All in Technology
映像変換サーバーなしで端末内でHLSを生成してライブ配信
hikarusato
0
110
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
4
1.7k
30座EKS, 180次升級淬煉的EKS Upgrade Skill 的歷程
eric8230
0
160
TinyGo 開発サイクルを高速化する:Go で作るエミュレータ入門
zozotech
PRO
1
740
幾何アルゴリズムで なめらかなピン操作を / iOSDC Japan 2026 / smoothpin
kazumanagano
0
350
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
AI de Idea
kawaguti
PRO
2
110
Claude Codeを「使うほど育つ」AI秘書にするノウハウ
minorun365
PRO
29
24k
人間はどの意思決定を手放せるのか
kawasima
14
6.9k
日経電子版を支えていく Kasane Design System/fec_fukuoka
nikkei_engineer_recruiting
0
1.6k
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
130
2026_devsumi_ozono.pdf
o3
3
510
Featured
See All Featured
It's Worth the Effort
3n
188
29k
エンジニアに許された特別な時間の終わり
watany
109
250k
The Invisible Side of Design
smashingmag
301
52k
Deep Space Network (abreviated)
tonyrice
0
310
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Mind Mapping
helmedeiros
1
360
Designing for Performance
lara
611
70k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Transcript
Mats Bryntse, Bryntum JS Testing and Continuous Integration @Bryntum
Intro | PRESENTATION Who am I?
Agenda | Content Unit tests UI tests Continuous Integration •
Writing a unit test • Using PhantomJS • Hello world sample • Testing a view • Recording a UI test • Application test • TeamCity • Code Coverage • Statistics • Cloud Testing
Intro | DESCRIPTION Less Theory, More Real World
Intro | WHY Hands up: Who is testing their JS?
Intro | WHY
Intro | WHY 1. Productivity & confidence in code 2.
Frameworks contain bugs 3. So does your code (and mine) 4. Refactoring & code handover 5. Fix bugs once
Intro | TERMINOLOGY Terminology: what does testing mean for a
JS developer?
Intro | TERMINOLOGY Unit tests, UI tests, Application tests..?
Intro | Test pyramid JS Unit tests App Tests UI
tests
Intro | Common company scenario Backend unit tests App Tests
Unit Tests Introduction
Intro | Unit Tests • should focus on a single
JS class (“unit”) • should not involve DOM • is pure logic, runs very fast • is perfect for pre-commit hooks A unit test…
Intro | Unit Tests describe('A simple Model test', function (t)
{ t.it('Should do something', function(t) { var user = new User({ name : ‘Bob’ }); t.expect(user.name).toBe(‘Bob’); }); });
Intro | Unit Tests describe('A simple Model test', function (t)
{ t.it(‘Will not run', function(t) { … }); t.iit(‘Isolate this section', function(t) { … }); });
Unit tests | Intro •Should be your #1 priority •Cover
your most important JS classes, code that is reused •Run often, before commit, daily, nightly. •Use TDD approach + BDD style for readability
Unit tests | TDD basics 1. Make the unit test
fail 2. Implement 3. Make the test pass 4. Refactor, Repeat
Unit tests | Writing a unit test Unit testing demo
Testing your UI Functional testing
UI tests | Intro Manually writing UI tests takes time
UI tests | Intro UI tests are more fragile &
run slower than unit tests
UI tests | Intro Understanding CSS and ComponentQuery is key
UI tests | Intro •UI “unit test” of a single
UI component •Or Application test, open index.html and test it Two main types of UI tests
UI tests | Intro UI Unit test demo
Application Tests Introduction
Application tests | Intro •Black box testing, go to index.html…
•Runs all the code of your application •Does app work or not?
Application tests | Challenges •Database needs to be put in
a known state pre test start •Slow •Fragile, race conditions •Errors likely harder to find
Application tests | Intro Using an Event Recorder
Application tests | Event recorder •Great for application tests •Records
user actions: clicks, types, drag drop •Can be used by a non-programmer •Big timesaver
Application tests | Event recorder Let’s try the recorder
Application tests | Monkey tests Monkey testing
Application tests | Monkey tests •Random UI testing •Clicks, drags
etc. in your UI •Finds unhandled exceptions •Free testing help. 0€
Application tests | Monkey tests Cost breakdown: 5€ * 0
= 0 5€
Application tests | Monkey tests Monkey testing demo
Application tests | Monkey tests Cheap/Free way to catch bugs
Finding bugs | Error logging Error Logging
Finding bugs | Error logging Unhandled JS exception: What does
the user see?
Finding bugs | Error logging Nothing
Finding bugs | Error logging win.onerror = function (message, file,
line, column, errorObj) { // Log it };
Finding bugs | Error logging Demo - it’s simple
Finding bugs | Git hooks Pre-commit hook
Finding bugs | Pre-commit hook •Pre-commit hooks are great to
keep code base clean •Check JsHint •Run unit tests
Finding bugs | Pre-commit hook A sample Git pre-commit hook
Continuous Integration TeamCity, Code Coverage & Statistics
Continuous Integration | Intro •Automated builds •Nightly test suite execution
•Finding errors early => Code quality => Motivated developers •Enables Continuous Delivery Purpose of having CI:
Continuous Integration | Intro Always ready to release!
Continuous Integration | Intro •Bryntum uses TeamCity •Test suites run
every 2 hours in Chrome •Full test suites executed nightly •Reports, statistics, charts and code coverage
Continuous Integration | TeamCity Let’s checkout TeamCity
Continuous Integration | Cloud testing So…running in multiple browsers?
Continuous Integration | Cloud testing •Need to create Virtual Machines
for each version of IE •Total: Chrome, Safari, FF, IE 7-11 => 8 VMs •Managing such a farm can be very time consuming
Continuous Integration | Cloud testing •Siesta integrates with both BrowserStack
and Sauce Labs •Run tests easily in any OS and Browser combination •No need to setup your own VM farm •Read more on the Bryntum blog…
Continuous Integration | Cloud testing Launching tests in BrowserStack
Rounding up | Summary •Prioritise JS unit tests •UI tests
•Application & monkey tests •Tips for finding errors early •Continuous Integration
Rounding up | Links •bryntum.com/products/siesta •bryntum.com/blog •teamcity.bryntum.com/guest •browserstack.com/ •saucelabs.com/
Rounding up | Fika Dear Ladies and Gentlemen,
you are now welcome to ”Vinterträdgården” for a lovely coffee break that is sponsored by
Rounding up | Questions Questions? Twitter: @Bryntum