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
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Empathic Computing: Creating Shared Understanding
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Diabetes mellitus diagnosis method based random forest with bat algorithm
Transforming Manufacturing operations through Intelligent Integrations
Review of recent advances in non-invasive hemoglobin estimation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Spectroscopy.pptx food analysis technology
NewMind AI Weekly Chronicles - August'25 Week I
Empathic Computing: Creating Shared Understanding
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The Rise and Fall of 3GPP – Time for a Sabbatical?
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Sensors and Actuators in IoT Systems using pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Advanced Soft Computing BINUS July 2025.pdf
madgavkar20181017ppt McKinsey Presentation.pdf

[FullStack NYC 2019] Effective Unit Tests for JavaScript