SlideShare a Scribd company logo
Hazem Saleh
Software Architect @Viacom New York
Integration.
Traditional Code
Coverage Overview
JavaScript Stryker
Demo.
Code Coverage Tools
in JavaScript.
What about
JavaScript
frameworks?
Code Coverage
Demo.
Current challenges of
traditional code
coverage.
Angular Stryker
Demo.
Mutation Testing 101. Q & A.
What and Why
Stryker?
1
2
3
4
5
6
7
8
9
10
11
§ Code Coverage represents the amount of source code
which will be executed when test cases run.
§ In order to measure the amount of tested source code,
there are popular coverage criteria:
Statement coverage Function coverage Branch coverage
§ There are many code coverage tools in JavaScript space.
§ If we are using Karma as a test runner for JavaScript unit tests, then we can
absolutely use karma-coverage plugin:
§ Karma-coverage is based on the popular Istanbul tool:
https://github.com/karma-runner/karma-coverage
https://github.com/gotwarlost/istanbul
§ To install karma-coverage, simply:
[FullStack NYC 2019] Effective Unit Tests for JavaScript
Sample URL:
https://github.com/hazems/helloworld-stryker
Demo
Challenges
Only measure the amount
of executed code.
Does not guarantee that
unit tests will fail, if there
is a change in a logic that
was not asserted before.
Does not show how strong
your unit tests are.
Does not detect code faults.
TCC
§ Mutation testing is about seeding app source
code with faults (mutations).
§ After seeding, unit tests execute:
§ If a unit test fails, then a mutation is killed (and means
that your unit test is strong enough to face this mutation).
§ If a unit test succeeds, then a mutation is lived (and
means that your unit test needs modification to be
stronger).
§ In mutation testing, the quality of the test can be
measured by the percentage of the killed
mutations.
§ One of the mutation testing tools for JavaScript.
§ It has the following advantages:
Powered by CLI
Compatible with:
Active project. Easy to configure.
Provides easy to
read test reports.
ReactAngular
JavaScript/
TypeScript
Vue.js
1
2
3
Arithmetic Operator
Array Declaration Operator
Block Statement Operator
4
5
6
Assignment Expression Operator
Conditional Expression Operator
Boolean Literal Operator
7
8
9
Equality Operator
String Literal Operator
Logical Operator
10
11
Update Operator
Unary Operator
§ Install Stryker CLI in your project root directory
§ Then
§ Then Answer the questionnaire
npm install -g stryker-cli
stryker init
§ Checkout stryker.conf.js file.
§ Check the mutation results by executing the following
command: > stryker run
Sample URL:
https://github.com/hazems/helloworld-stryker
Demo
§ Fortunately, Stryker can work perfectly with the most popular
JavaScript frameworks/libraries.
§ You can use Stryker with the following
Sample URL:
https://github.com/hazems/ng-stryker-github-
sample
Demo
It is recommended to use Stryker with Angular CLI 6.1.0 or
above.
Q & A
Further Resources:
• Stryker for JavaScript:
https://github.com/stryker-mutator/stryker
Session Samples:
• Stryker for JavaScript Demo:
https://github.com/hazems/helloworld-stryker
• Stryker for Angular Demo:
https://github.com/hazems/ng-stryker-github-sample
Twitter: @hazems

More Related Content

PDF
Unit Testing your React / Redux app (@BucharestJS)
PDF
How to go about testing in React?
PDF
Create an architecture for web test automation
PPTX
Testing of React JS app
PDF
Javascript tdd byandreapaciolla
PDF
Performance Testing | Instamojo
PPTX
Automated Infrastructure Testing
PPTX
Unit & integration testing
Unit Testing your React / Redux app (@BucharestJS)
How to go about testing in React?
Create an architecture for web test automation
Testing of React JS app
Javascript tdd byandreapaciolla
Performance Testing | Instamojo
Automated Infrastructure Testing
Unit & integration testing

What's hot (20)

PDF
Eclipse Day India 2015 - Eclipse RCP testing using Jubula based automation
PDF
Intro to front-end testing
PPT
Test Presentation
ODP
Integration Testing in Python
PDF
Integration testing - A&BP CC
PPTX
JavaScript Metaprogramming with ES 2015 Proxy
PDF
Gatling Performance Workshop
PPTX
Cypress Automation
PPTX
Dot all 2019 | Testing with Craft | Giel Tettelar
PPTX
AQA TALKS 4 - AUTOMATION TEST REPORTER
PDF
Meetup React Sanca - 29/11/18 - React Testing
PDF
prohuddle-utPLSQL v3 - Ultimate unit testing framework for Oracle
PPTX
Ntd2015_pt_kanban_ppt
PDF
100 tests per second - 40 releases per week
PPTX
Deterministic releases and how to get there with Nigel Babu
PPTX
Protractor
PPTX
Automation and Technical Debt
PPTX
Why you should switch to Cypress for modern web testing?
PPTX
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
PDF
Hadoop Summit 2013 : Continuous Integration on top of hadoop
Eclipse Day India 2015 - Eclipse RCP testing using Jubula based automation
Intro to front-end testing
Test Presentation
Integration Testing in Python
Integration testing - A&BP CC
JavaScript Metaprogramming with ES 2015 Proxy
Gatling Performance Workshop
Cypress Automation
Dot all 2019 | Testing with Craft | Giel Tettelar
AQA TALKS 4 - AUTOMATION TEST REPORTER
Meetup React Sanca - 29/11/18 - React Testing
prohuddle-utPLSQL v3 - Ultimate unit testing framework for Oracle
Ntd2015_pt_kanban_ppt
100 tests per second - 40 releases per week
Deterministic releases and how to get there with Nigel Babu
Protractor
Automation and Technical Debt
Why you should switch to Cypress for modern web testing?
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Hadoop Summit 2013 : Continuous Integration on top of hadoop
Ad

Similar to [FullStack NYC 2019] Effective Unit Tests for JavaScript (20)

PDF
Efficient JavaScript Unit Testing, JavaOne China 2013
PDF
Efficient JavaScript Unit Testing, May 2012
PDF
Efficient JavaScript Unit Testing, March 2013
PPTX
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
PPTX
Angular Unit testing.pptx
PDF
Testing Angular
PDF
Into The Box 2018 | Assert control over your legacy applications
PPTX
Resilience Testing
PPT
SoftTest Ireland: Model Based Testing - January 27th 2011
PDF
Javascript-heavy Salesforce Applications
PDF
Testing Spark and Scala
PPTX
Understanding JavaScript Testing
PDF
Laravel Load Testing: Strategies and Tools
PPTX
[AnDevCon 2016] Mutation Testing for Android
PDF
Beginning AngularJS
PDF
Unit Testing Fundamentals
PPT
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
PDF
Windmill Testing certification
PPTX
Codeception
PDF
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Efficient JavaScript Unit Testing, JavaOne China 2013
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, March 2013
Lessons Learned in Software Development: QA Infrastructure – Maintaining Rob...
Angular Unit testing.pptx
Testing Angular
Into The Box 2018 | Assert control over your legacy applications
Resilience Testing
SoftTest Ireland: Model Based Testing - January 27th 2011
Javascript-heavy Salesforce Applications
Testing Spark and Scala
Understanding JavaScript Testing
Laravel Load Testing: Strategies and Tools
[AnDevCon 2016] Mutation Testing for Android
Beginning AngularJS
Unit Testing Fundamentals
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Windmill Testing certification
Codeception
Testing Hourglass at Jira Frontend - by Alexey Shpakov, Sr. Developer @ Atlas...
Ad

More from Hazem Saleh (14)

PDF
Mockito 2.x Migration - Droidcon UK 2018
PDF
JavaScript Unit Testing with an Angular 5.x Use Case 101
PPTX
[ApacheCon 2016] Advanced Apache Cordova
PPTX
[Devoxx Morocco 2015] Apache Cordova In Action
PPTX
Apache Cordova In Action
PPTX
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
PPTX
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
PDF
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
PDF
Dojo >= 1.7 Kickstart
PDF
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013
PDF
JSF Mashups in Action
PDF
JavaScript tools
PDF
[JavaOne 2010] Abstract Mashups for Enterprise Java
PDF
GMaps4JSF
Mockito 2.x Migration - Droidcon UK 2018
JavaScript Unit Testing with an Angular 5.x Use Case 101
[ApacheCon 2016] Advanced Apache Cordova
[Devoxx Morocco 2015] Apache Cordova In Action
Apache Cordova In Action
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
Developing Native Mobile Apps Using JavaScript, ApacheCon NA 2014
Dojo >= 1.7 Kickstart
Efficient JavaScript Unit Testing (Chinese Version), JavaOne China 2013
JSF Mashups in Action
JavaScript tools
[JavaOne 2010] Abstract Mashups for Enterprise Java
GMaps4JSF

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
cuic standard and advanced reporting.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation theory and applications.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
A Presentation on Artificial Intelligence
cuic standard and advanced reporting.pdf
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Understanding_Digital_Forensics_Presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Empathic Computing: Creating Shared Understanding
Encapsulation theory and applications.pdf
NewMind AI Monthly Chronicles - July 2025
The AUB Centre for AI in Media Proposal.docx
“AI and Expert System Decision Support & Business Intelligence Systems”
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
NewMind AI Weekly Chronicles - August'25 Week I
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy

[FullStack NYC 2019] Effective Unit Tests for JavaScript