SlideShare a Scribd company logo
@GirlCodeNL
/GirlCodeNL
@GirlCodeNL
/GirlCodeNL
We are Girl Code
katja
ineke
@afkatja
@FYIneke
@GirlCodeNL
/GirlCodeNL
Jest
Easy setup
Snapshot testing
@GirlCodeNL
/GirlCodeNL
UI Testing & Libraries @ bloomon by Mariyana Nikolaeva
-- Break --
Unit testing using Mocha by Marie Treschow
Questions and discussion
Drinks
Program
1strictly confidential -
• tekst
• tekst
• tekst
Agenda
UI testing
and component libraries
bloomon & girl code 2018
2strictly confidential -
• bloomon - stack and applications
• problem - many variations of the same component across apps
• solutions - storybook vs component library (e.g. material UI)
• summary - why consistency is important
In today’s talk:
3strictly confidential -
stack
4strictly confidential -
applications
customer-
facing
backofficeAPI microservices
5strictly confidential -
Inconsistent UI elements
6strictly confidential -
the button(s)
7strictly confidential -
possible solutions
bloomon UI
8strictly confidential -
storybook
9strictly confidential -
10strictly confidential -
component library
11strictly confidential -
• fork material ui repository
• add bloomon components to as
submodule
• include material-ui as dependency in
package.json
• make imports from material-ui bloomon components
Approach
12strictly confidential -
13strictly confidential -
storybook
• quick to include in apps
• no build script required
• easy component preview
• no centralized components
• storybook addons not mature
enough
Pros and Cons
component library
• one repo for components
• easy to import in apps
• unified documentation
• overhead of build and run tools
• maintain repository or CDN
• complex task
14strictly confidential -
• visual vocabulary between designers, UX and developers
• faster designs and implementation
• unified UIs and brand trust
• users learn how to use the UI faster
• less style micro decision to be made by developers
• single source of truth without code repetition
Why consistency is important
15strictly confidential -
Learnings
16strictly confidential -
Do not fork big repositories
17strictly confidential -
Small, easy steps
• styles repository
• storybooks for components per app
• storybook repository (as submodules, npm package)
• UI tests - structural, interaction, style testing
• component library with unit, integration and visual regression
tests
• well documented and hosted styleguide website
18strictly confidential -
Thank you
Unit testing with
Mocha
npm install mocha -g
Marie Treschow
Tonight’s Agenda
➔ Why testing?
➔ Testing levels
➔ Impact of good testing
➔ Unit Testing
➔ TDD vs BDD
➔ Mocha Framework
➔ Chai Assertion Library
➔ Sinon.js
Why Unit Testing?
“Adding value, not just bugs”
- Improve software quality
- Find bugs early
- Makes process agile
- Provides documentation
- Simplify debugging process
- Architecture
- Reduces cost
Different levels of software testing
Regression testing => previously developed software still performs
Acceptance testing => testing with respect to users needs
System testing => testing integrated system
Integration testing => individual units are combined
Unit testing => testing individual components
Business value of testing
★ Reliability
★ Customer satisfaction
★ Profitability
★ Shorter time to market
UNIT TESTING … where it all begins
What it is?
● Lowest level of software testing
● Individual units and components are tested
● Validate that each unit of code performs as designed
What it does?
➔ increase confidence in changing/maintaining code
➔ makes your code more reusable
➔ makes debugging easier
➔ code more reliable
What’s a good unit test?
1. Fast
2. Small
3. Simple
4. Plentiful
5. Isolated
6. Readable
7. Clean
What not to do...
Simple unit test
Terminal output
Testing your JavaScript
with Mocha, Chai and Sinon
Setting up
Mocha|Chai|Sinon
npm install mocha -g (OR) --save-dev
update your package.json and customize
your scripts in order to run mocha on
your terms, then simply run npm test
npm install chai --save-dev
npm install sinon --save-dev
Why Mocha?
★ Well maintained
★ Well documented
★ Optional assertion library
★ Supports TDD & BDD
★ Simplifies async testing
Let’s look at the features!
The power of Mocha
Features & Options:
● Browser support
● Async support, including
promises
● Test coverage reporting
● Hooks
● Test-specific timeouts
● Report test duration
● Highlights slow tests in
red and yellow
Useful flags:
- File watcher support
- Babel-hook
- Node debugger support
- Timeout
Psst.. check out:
https://mochajs.org/
Simple async module
Asynchronous testing with Mocha
Terminal output
TDD (test driven) vs. BDD (behavior driven)
1. Write the test
2. Run the test and see
it fail
3. Write the code
4. Run the test again
(not failing anymore)
5. Refactor
- More focused on the
features, not results
- Important: the ability
to read your tests like
a sentence is a
cognitive shift in how
you will think about it
Let’s imagine this function:
function factorial(n){
if(n < 0) return NaN;
if(n === 0) return 1;
return n * factorial(n-1);
}
TDD style exampleBDD style example
Terminal output
HOOKS
before();
runs before any tests in each describe() block
after();
runs after all tests in each describe() block
beforeEach();
runs before every test in a describe block
afterEach();
runs after every test in a describe block
Good for: setting up preconditions and clean up after your tests
(database fixture, servers etc)
Pieces of code run either before or after certain tests
Hooks output example
Chai - should, expect, assert
● Pair with any JavaScript
testing framework
● Several interfaces that
allow you to choose
between whatever is
comfortable
Should (BDD)
Expect (BDD)
Assert (TDD)
expect('test').to.be.a('string');
[1,2,3].indexOf(4).should.equal(-1);
assert.strictEqual(true, true, ‘booleans are strictly equal’);
Assertion Methods
● equal
● strictEqual (===)
● deepEqual
● isNull
● include
● property
assert.deepEqual({ tea: 'green' }, { tea: 'green' });
assert.isNull(error, 'there was no error');
assert.include([1,2,3], 2, 'array contains value 2');
assert.property({ tea: { green: 'matcha' }}, 'property tea');
And some negative ones
● notEqual
● isNotOk
● notDeepEqual
● isNotNull
● notStrictEqual
assert.notEqual(3, 4, 'these numbers are not equal');
assert.isNotOk(false, 'this will pass');
assert.notDeepEqual({ tea: 'green'}, { tea: 'red'});
Sinon - spies, stubs, mocks
Things that makes testing hard:
➢ Databases
➢ Network
➢ File access
Spies/Stubs/Mocks: Test Doubles
➢ Replacements for pieces of code used in
your test
Different kinds of Test Doubles:
● Spies -> offer information about
function calls without affecting
their behavior
● Stubs -> are like spies, but
completely replace the function
(make it do whatever you like!)
● Mocks -> makes replacing whole
objects easy by combining both spies
and stubs (fake servers, timers,
xmlhttprequest)
http://sinonjs.org/
Testing TIPS:
➔ Keep your modules small
➔ Be sure to test success AND error
cases
➔ Test expected AND unexpected data
Thanks for listening!
Ad

More Related Content

What's hot (20)

Report portal
Report portalReport portal
Report portal
COMAQA.BY
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
Integration Group - Robot Framework
Integration Group - Robot Framework Integration Group - Robot Framework
Integration Group - Robot Framework
OpenDaylight
 
Scripting robot
Scripting robotScripting robot
Scripting robot
Chonlasith Jucksriporn
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
Gavin Pickin
 
Introduction to Robot Framework
Introduction to Robot FrameworkIntroduction to Robot Framework
Introduction to Robot Framework
Somkiat Puisungnoen
 
Rsyslog version naming (v8.6.0+)
Rsyslog version naming (v8.6.0+)Rsyslog version naming (v8.6.0+)
Rsyslog version naming (v8.6.0+)
Rainer Gerhards
 
C++ Testing Techniques Tips and Tricks - C++ London
C++ Testing Techniques Tips and Tricks - C++ LondonC++ Testing Techniques Tips and Tricks - C++ London
C++ Testing Techniques Tips and Tricks - C++ London
Clare Macrae
 
SQL or NoSQL - how to choose
SQL or NoSQL - how to chooseSQL or NoSQL - how to choose
SQL or NoSQL - how to choose
Lars Thorup
 
Robot framework
Robot frameworkRobot framework
Robot framework
Rochak Bhalla
 
Blazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java UniverseBlazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java Universe
Michał Kordas
 
Make sure your code works
Make sure your code worksMake sure your code works
Make sure your code works
Henrik Skupin
 
Robot Framework
Robot FrameworkRobot Framework
Robot Framework
Onur Baskirt
 
Robot Framework :: Demo login application
Robot Framework :: Demo login applicationRobot Framework :: Demo login application
Robot Framework :: Demo login application
Somkiat Puisungnoen
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)
Alin Pandichi
 
Robot framework Gowthami Goli
Robot framework Gowthami GoliRobot framework Gowthami Goli
Robot framework Gowthami Goli
Gowthami Buddi
 
Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1
Tuenti
 
ATDD Using Robot Framework
ATDD Using Robot FrameworkATDD Using Robot Framework
ATDD Using Robot Framework
Pekka Klärck
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java Project
GlobalLogic Ukraine
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravel
Derek Binkley
 
3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin
 
Integration Group - Robot Framework
Integration Group - Robot Framework Integration Group - Robot Framework
Integration Group - Robot Framework
OpenDaylight
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
Gavin Pickin
 
Rsyslog version naming (v8.6.0+)
Rsyslog version naming (v8.6.0+)Rsyslog version naming (v8.6.0+)
Rsyslog version naming (v8.6.0+)
Rainer Gerhards
 
C++ Testing Techniques Tips and Tricks - C++ London
C++ Testing Techniques Tips and Tricks - C++ LondonC++ Testing Techniques Tips and Tricks - C++ London
C++ Testing Techniques Tips and Tricks - C++ London
Clare Macrae
 
SQL or NoSQL - how to choose
SQL or NoSQL - how to chooseSQL or NoSQL - how to choose
SQL or NoSQL - how to choose
Lars Thorup
 
Blazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java UniverseBlazing Fast Feedback Loops in the Java Universe
Blazing Fast Feedback Loops in the Java Universe
Michał Kordas
 
Make sure your code works
Make sure your code worksMake sure your code works
Make sure your code works
Henrik Skupin
 
Robot Framework :: Demo login application
Robot Framework :: Demo login applicationRobot Framework :: Demo login application
Robot Framework :: Demo login application
Somkiat Puisungnoen
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)
Alin Pandichi
 
Robot framework Gowthami Goli
Robot framework Gowthami GoliRobot framework Gowthami Goli
Robot framework Gowthami Goli
Gowthami Buddi
 
Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1Tuenti Release Workflow v1.1
Tuenti Release Workflow v1.1
Tuenti
 
ATDD Using Robot Framework
ATDD Using Robot FrameworkATDD Using Robot Framework
ATDD Using Robot Framework
Pekka Klärck
 
Battle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java ProjectBattle for Code Quality - A Story of One Java Project
Battle for Code Quality - A Story of One Java Project
GlobalLogic Ukraine
 
Testing with laravel
Testing with laravelTesting with laravel
Testing with laravel
Derek Binkley
 

Similar to Developers Testing - Girl Code at bloomon (20)

Integration testing - A&BP CC
Integration testing - A&BP CCIntegration testing - A&BP CC
Integration testing - A&BP CC
JWORKS powered by Ordina
 
QA Meetup at Signavio (Berlin, 06.06.19)
QA Meetup at Signavio (Berlin, 06.06.19)QA Meetup at Signavio (Berlin, 06.06.19)
QA Meetup at Signavio (Berlin, 06.06.19)
Anesthezia
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
Rogue Wave Software
 
StarWest 2019 - End to end testing: Stupid or Legit?
StarWest 2019 - End to end testing: Stupid or Legit?StarWest 2019 - End to end testing: Stupid or Legit?
StarWest 2019 - End to end testing: Stupid or Legit?
mabl
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
SPC Adriatics
 
Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.
Malinda Kapuruge
 
DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and Projects
Fedir RYKHTIK
 
Continuous Delivery in Practice (extended)
Continuous Delivery in Practice (extended)Continuous Delivery in Practice (extended)
Continuous Delivery in Practice (extended)
Tzach Zohar
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
Binary Studio
 
NET Code Testing
NET Code TestingNET Code Testing
NET Code Testing
Kirill Miroshnichenko
 
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Борис Зора
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
Mohammed Moishin
 
Deploying ML models to production (frequently and safely) - PYCON 2018
Deploying ML models to production (frequently and safely) - PYCON 2018Deploying ML models to production (frequently and safely) - PYCON 2018
Deploying ML models to production (frequently and safely) - PYCON 2018
David Tan
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
CIVEL Benoit
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
CIVEL Benoit
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
Jim Driscoll
 
Anatomy of a Build Pipeline
Anatomy of a Build PipelineAnatomy of a Build Pipeline
Anatomy of a Build Pipeline
Samuel Brown
 
Gabriel carabat a healthy approach for test automation
Gabriel carabat   a healthy approach for test automationGabriel carabat   a healthy approach for test automation
Gabriel carabat a healthy approach for test automation
Romania Testing
 
PASS 2024 - Best Practices for Development on Azure Databricks
PASS 2024 - Best Practices for Development on Azure DatabricksPASS 2024 - Best Practices for Development on Azure Databricks
PASS 2024 - Best Practices for Development on Azure Databricks
Dustin Vannoy
 
Continuous Security Testing with Devops - OWASP EU 2014
Continuous Security Testing  with Devops - OWASP EU 2014Continuous Security Testing  with Devops - OWASP EU 2014
Continuous Security Testing with Devops - OWASP EU 2014
Stephen de Vries
 
QA Meetup at Signavio (Berlin, 06.06.19)
QA Meetup at Signavio (Berlin, 06.06.19)QA Meetup at Signavio (Berlin, 06.06.19)
QA Meetup at Signavio (Berlin, 06.06.19)
Anesthezia
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
Rogue Wave Software
 
StarWest 2019 - End to end testing: Stupid or Legit?
StarWest 2019 - End to end testing: Stupid or Legit?StarWest 2019 - End to end testing: Stupid or Legit?
StarWest 2019 - End to end testing: Stupid or Legit?
mabl
 
Lean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill AyersLean-Agile Development with SharePoint - Bill Ayers
Lean-Agile Development with SharePoint - Bill Ayers
SPC Adriatics
 
Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.Understanding TDD - theory, practice, techniques and tips.
Understanding TDD - theory, practice, techniques and tips.
Malinda Kapuruge
 
DevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and ProjectsDevOps for TYPO3 Teams and Projects
DevOps for TYPO3 Teams and Projects
Fedir RYKHTIK
 
Continuous Delivery in Practice (extended)
Continuous Delivery in Practice (extended)Continuous Delivery in Practice (extended)
Continuous Delivery in Practice (extended)
Tzach Zohar
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
Binary Studio
 
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Борис Зора
 
Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
Mohammed Moishin
 
Deploying ML models to production (frequently and safely) - PYCON 2018
Deploying ML models to production (frequently and safely) - PYCON 2018Deploying ML models to production (frequently and safely) - PYCON 2018
Deploying ML models to production (frequently and safely) - PYCON 2018
David Tan
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
CIVEL Benoit
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
CIVEL Benoit
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
Jim Driscoll
 
Anatomy of a Build Pipeline
Anatomy of a Build PipelineAnatomy of a Build Pipeline
Anatomy of a Build Pipeline
Samuel Brown
 
Gabriel carabat a healthy approach for test automation
Gabriel carabat   a healthy approach for test automationGabriel carabat   a healthy approach for test automation
Gabriel carabat a healthy approach for test automation
Romania Testing
 
PASS 2024 - Best Practices for Development on Azure Databricks
PASS 2024 - Best Practices for Development on Azure DatabricksPASS 2024 - Best Practices for Development on Azure Databricks
PASS 2024 - Best Practices for Development on Azure Databricks
Dustin Vannoy
 
Continuous Security Testing with Devops - OWASP EU 2014
Continuous Security Testing  with Devops - OWASP EU 2014Continuous Security Testing  with Devops - OWASP EU 2014
Continuous Security Testing with Devops - OWASP EU 2014
Stephen de Vries
 
Ad

More from Ineke Scheffers (8)

Coding Accessibility - Girl Code at Incentro
Coding Accessibility - Girl Code at IncentroCoding Accessibility - Girl Code at Incentro
Coding Accessibility - Girl Code at Incentro
Ineke Scheffers
 
Back to the future - Girl Code talks AI @ ING
Back to the future - Girl Code talks AI @ INGBack to the future - Girl Code talks AI @ ING
Back to the future - Girl Code talks AI @ ING
Ineke Scheffers
 
All about Front End - Girl Code @ ANWB
All about Front End - Girl Code @ ANWBAll about Front End - Girl Code @ ANWB
All about Front End - Girl Code @ ANWB
Ineke Scheffers
 
Building Rock-Paper-Scissors: Girl Code meets Ruby at Codaisseur
Building Rock-Paper-Scissors: Girl Code meets Ruby at CodaisseurBuilding Rock-Paper-Scissors: Girl Code meets Ruby at Codaisseur
Building Rock-Paper-Scissors: Girl Code meets Ruby at Codaisseur
Ineke Scheffers
 
Challenges of a Girl Coder
Challenges of a Girl CoderChallenges of a Girl Coder
Challenges of a Girl Coder
Ineke Scheffers
 
How neural networks can make a drone your next best friend, by Tessie Hartjes...
How neural networks can make a drone your next best friend, by Tessie Hartjes...How neural networks can make a drone your next best friend, by Tessie Hartjes...
How neural networks can make a drone your next best friend, by Tessie Hartjes...
Ineke Scheffers
 
Girl code meets IOT
Girl code meets IOTGirl code meets IOT
Girl code meets IOT
Ineke Scheffers
 
Girl Code, Q42 at Nerds on Stage
Girl Code, Q42 at Nerds on StageGirl Code, Q42 at Nerds on Stage
Girl Code, Q42 at Nerds on Stage
Ineke Scheffers
 
Coding Accessibility - Girl Code at Incentro
Coding Accessibility - Girl Code at IncentroCoding Accessibility - Girl Code at Incentro
Coding Accessibility - Girl Code at Incentro
Ineke Scheffers
 
Back to the future - Girl Code talks AI @ ING
Back to the future - Girl Code talks AI @ INGBack to the future - Girl Code talks AI @ ING
Back to the future - Girl Code talks AI @ ING
Ineke Scheffers
 
All about Front End - Girl Code @ ANWB
All about Front End - Girl Code @ ANWBAll about Front End - Girl Code @ ANWB
All about Front End - Girl Code @ ANWB
Ineke Scheffers
 
Building Rock-Paper-Scissors: Girl Code meets Ruby at Codaisseur
Building Rock-Paper-Scissors: Girl Code meets Ruby at CodaisseurBuilding Rock-Paper-Scissors: Girl Code meets Ruby at Codaisseur
Building Rock-Paper-Scissors: Girl Code meets Ruby at Codaisseur
Ineke Scheffers
 
Challenges of a Girl Coder
Challenges of a Girl CoderChallenges of a Girl Coder
Challenges of a Girl Coder
Ineke Scheffers
 
How neural networks can make a drone your next best friend, by Tessie Hartjes...
How neural networks can make a drone your next best friend, by Tessie Hartjes...How neural networks can make a drone your next best friend, by Tessie Hartjes...
How neural networks can make a drone your next best friend, by Tessie Hartjes...
Ineke Scheffers
 
Girl Code, Q42 at Nerds on Stage
Girl Code, Q42 at Nerds on StageGirl Code, Q42 at Nerds on Stage
Girl Code, Q42 at Nerds on Stage
Ineke Scheffers
 
Ad

Recently uploaded (20)

Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 

Developers Testing - Girl Code at bloomon

  • 2. @GirlCodeNL /GirlCodeNL We are Girl Code katja ineke @afkatja @FYIneke
  • 4. @GirlCodeNL /GirlCodeNL UI Testing & Libraries @ bloomon by Mariyana Nikolaeva -- Break -- Unit testing using Mocha by Marie Treschow Questions and discussion Drinks Program
  • 5. 1strictly confidential - • tekst • tekst • tekst Agenda UI testing and component libraries bloomon & girl code 2018
  • 6. 2strictly confidential - • bloomon - stack and applications • problem - many variations of the same component across apps • solutions - storybook vs component library (e.g. material UI) • summary - why consistency is important In today’s talk:
  • 11. 7strictly confidential - possible solutions bloomon UI
  • 15. 11strictly confidential - • fork material ui repository • add bloomon components to as submodule • include material-ui as dependency in package.json • make imports from material-ui bloomon components Approach
  • 17. 13strictly confidential - storybook • quick to include in apps • no build script required • easy component preview • no centralized components • storybook addons not mature enough Pros and Cons component library • one repo for components • easy to import in apps • unified documentation • overhead of build and run tools • maintain repository or CDN • complex task
  • 18. 14strictly confidential - • visual vocabulary between designers, UX and developers • faster designs and implementation • unified UIs and brand trust • users learn how to use the UI faster • less style micro decision to be made by developers • single source of truth without code repetition Why consistency is important
  • 20. 16strictly confidential - Do not fork big repositories
  • 21. 17strictly confidential - Small, easy steps • styles repository • storybooks for components per app • storybook repository (as submodules, npm package) • UI tests - structural, interaction, style testing • component library with unit, integration and visual regression tests • well documented and hosted styleguide website
  • 23. Unit testing with Mocha npm install mocha -g Marie Treschow
  • 24. Tonight’s Agenda ➔ Why testing? ➔ Testing levels ➔ Impact of good testing ➔ Unit Testing ➔ TDD vs BDD ➔ Mocha Framework ➔ Chai Assertion Library ➔ Sinon.js
  • 25. Why Unit Testing? “Adding value, not just bugs” - Improve software quality - Find bugs early - Makes process agile - Provides documentation - Simplify debugging process - Architecture - Reduces cost
  • 26. Different levels of software testing Regression testing => previously developed software still performs Acceptance testing => testing with respect to users needs System testing => testing integrated system Integration testing => individual units are combined Unit testing => testing individual components
  • 27. Business value of testing ★ Reliability ★ Customer satisfaction ★ Profitability ★ Shorter time to market
  • 28. UNIT TESTING … where it all begins What it is? ● Lowest level of software testing ● Individual units and components are tested ● Validate that each unit of code performs as designed What it does? ➔ increase confidence in changing/maintaining code ➔ makes your code more reusable ➔ makes debugging easier ➔ code more reliable
  • 29. What’s a good unit test? 1. Fast 2. Small 3. Simple 4. Plentiful 5. Isolated 6. Readable 7. Clean What not to do...
  • 31. Testing your JavaScript with Mocha, Chai and Sinon
  • 32. Setting up Mocha|Chai|Sinon npm install mocha -g (OR) --save-dev update your package.json and customize your scripts in order to run mocha on your terms, then simply run npm test npm install chai --save-dev npm install sinon --save-dev
  • 33. Why Mocha? ★ Well maintained ★ Well documented ★ Optional assertion library ★ Supports TDD & BDD ★ Simplifies async testing Let’s look at the features!
  • 34. The power of Mocha Features & Options: ● Browser support ● Async support, including promises ● Test coverage reporting ● Hooks ● Test-specific timeouts ● Report test duration ● Highlights slow tests in red and yellow Useful flags: - File watcher support - Babel-hook - Node debugger support - Timeout Psst.. check out: https://mochajs.org/
  • 36. Asynchronous testing with Mocha Terminal output
  • 37. TDD (test driven) vs. BDD (behavior driven) 1. Write the test 2. Run the test and see it fail 3. Write the code 4. Run the test again (not failing anymore) 5. Refactor - More focused on the features, not results - Important: the ability to read your tests like a sentence is a cognitive shift in how you will think about it Let’s imagine this function: function factorial(n){ if(n < 0) return NaN; if(n === 0) return 1; return n * factorial(n-1); }
  • 38. TDD style exampleBDD style example
  • 40. HOOKS before(); runs before any tests in each describe() block after(); runs after all tests in each describe() block beforeEach(); runs before every test in a describe block afterEach(); runs after every test in a describe block Good for: setting up preconditions and clean up after your tests (database fixture, servers etc) Pieces of code run either before or after certain tests
  • 42. Chai - should, expect, assert ● Pair with any JavaScript testing framework ● Several interfaces that allow you to choose between whatever is comfortable Should (BDD) Expect (BDD) Assert (TDD) expect('test').to.be.a('string'); [1,2,3].indexOf(4).should.equal(-1); assert.strictEqual(true, true, ‘booleans are strictly equal’);
  • 43. Assertion Methods ● equal ● strictEqual (===) ● deepEqual ● isNull ● include ● property assert.deepEqual({ tea: 'green' }, { tea: 'green' }); assert.isNull(error, 'there was no error'); assert.include([1,2,3], 2, 'array contains value 2'); assert.property({ tea: { green: 'matcha' }}, 'property tea');
  • 44. And some negative ones ● notEqual ● isNotOk ● notDeepEqual ● isNotNull ● notStrictEqual assert.notEqual(3, 4, 'these numbers are not equal'); assert.isNotOk(false, 'this will pass'); assert.notDeepEqual({ tea: 'green'}, { tea: 'red'});
  • 45. Sinon - spies, stubs, mocks Things that makes testing hard: ➢ Databases ➢ Network ➢ File access Spies/Stubs/Mocks: Test Doubles ➢ Replacements for pieces of code used in your test
  • 46. Different kinds of Test Doubles: ● Spies -> offer information about function calls without affecting their behavior ● Stubs -> are like spies, but completely replace the function (make it do whatever you like!) ● Mocks -> makes replacing whole objects easy by combining both spies and stubs (fake servers, timers, xmlhttprequest) http://sinonjs.org/
  • 47. Testing TIPS: ➔ Keep your modules small ➔ Be sure to test success AND error cases ➔ Test expected AND unexpected data Thanks for listening!