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
Who watches the watchmen: testing our tests
Search
Maria Clara Santana
July 05, 2018
Programming
1
210
Who watches the watchmen: testing our tests
The talk was given at JS Experience 2018.
https://eventos.imasters.com.br/jsexperience
Maria Clara Santana
July 05, 2018
Tweet
Share
More Decks by Maria Clara Santana
See All by Maria Clara Santana
You might also like...
olarclara
0
94
Accessibility beyond the aria-label
olarclara
1
150
React nas Trincheiras
olarclara
3
270
ImmutableJS 101
olarclara
0
100
Other Decks in Programming
See All in Programming
TCAとKMPを用いた新規動画配信アプリ 「ABEMA Live」の設計
tomu28
1
110
ゆるい個人開発のススメ
kuroppe1819
10
990
AWS Application Composerで始める、 サーバーレスなデータ基盤構築 / 20240406-jawsug-hokuriku-shinkansen
kasacchiful
1
260
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
840
educure_カリキュラム生操作マニュアル.pdf
linew_official
0
810
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
340
Node.js v22 で変わること
yosuke_furukawa
PRO
9
3.5k
R言語の環境構築と基礎 Tokyo.R 112
bob3bob3
0
270
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
340
使ってみよう Azure AI Document Intelligence
kosmosebi
2
320
Micro Frontends for Java Microservices - Devnexus 2024
mraible
PRO
0
490
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
274
13k
Building Applications with DynamoDB
mza
88
5.6k
We Have a Design System, Now What?
morganepeng
43
6.8k
WebSockets: Embracing the real-time Web
robhawkes
59
7k
Building Flexible Design Systems
yeseniaperezcruz
319
37k
Practical Orchestrator
shlominoach
182
9.7k
Web Components: a chance to create the future
zenorocha
305
41k
jQuery: Nuts, Bolts and Bling
dougneiner
59
7.1k
Debugging Ruby Performance
tmm1
70
11k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
Documentation Writing (for coders)
carmenintech
60
3.9k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
187
16k
Transcript
“WHO WATCHES THE WATCHMEN” Testing our tests Maria C. Santana
JS Experience ‘18
Maria Clara • Front-end Developer @ Picter • Live Coding
Instructor @ Udacity • Likes dogs and sparkling water
Types of software errors • Construction errors; • Specification errors;
• Design errors; • Requirements errors; Toward a theory of test data selection, Softech Inc.
BLACK-BOX TESTING
Input Output
None
None
•Pro: Allows to check the functionality of a program without
worrying with the structure behind it; •Con: Does not offer insights about the tested program’s structure;
High code coverage !== Effective Test Suite
Source: https://gph.is/1jE2Wzg
None
None
Take it with a grain of salt.
“Quis custodiet ipsos custodes?” Satires, 2a.c.
WHITE-BOX TESTING
Input Output
None
None
•Pro: More thorough tests; •Con: Can be complex and require
a lot of work due to implementation changes;
MUTATION TESTING
CONCEPT
#1 STEP Test data Original code
•If it fails, then the original program is wrong; •If
it passes, then we should proceed with creating mutants;
#2 STEP Test data N modified versions of the original
code
•#1: given the test data, the modified versions have different
outputs from the original one; •#2: some (or all of them) versions have the same output of the original one;
MUTATORS TYPES
Not this kind, though…
AAR (array for array replacement)
ABS (absolute value insertion)
AOR (arithmetic operator replacement)
UOI (unary operation insertion)
Many others… • Array constant replacement; • Logical connector replacement;
• Relational operator replacement; • Constant replacement; • Return statement replacement; • Statement deletion; • …
EXAMPLE
Original program
Test suite
Mutant #1 - Conditional operator replacement
Mutant #1 - Test suite results Mutant was killed!
Mutant #2 - Conditional operator replacement
Mutant #2 - Test suite results Mutant has survived… ☹
EQUIVALENT MUTANTS
None
Mutant #3 - Return statement replacement
Mutant #3 - Test suite results Mutant was killed!
mutation score = mutants killed / total of mutants; ->
100%
TOOLS
https://stryker-mutator.io/
Trade-offs •Open-source; •Active maintenance and improvements; •Supports most of the
mainstream runners (karma, jasmine, jest, …); •Does not support React;
Other languages… • Python: https://github.com/mutpy/mutpy; • Ruby: https://github.com/mbj/mutant; • Java:
https://github.com/hcoles/pitest;
PROS
•Application safety; •Evaluation of edge cases; •Better test design;
CONS
•High computational costs; •Filtering equivalent mutants is still a non-optimal
task;
Q&A
THANKS! olarclara.github.io