JEST: Testing Framework Guillermo Fernndez-Campoamor Fernndez - - PowerPoint PPT Presentation

jest testing framework
SMART_READER_LITE
LIVE PREVIEW

JEST: Testing Framework Guillermo Fernndez-Campoamor Fernndez - - PowerPoint PPT Presentation

JEST: Testing Framework Guillermo Fernndez-Campoamor Fernndez Carlos Manrique Enguita Elena Rodrguez Ro Diego Ramrez Amandi WHAT IS JEST? Jest is a JavaScript testing framework that focus on simplicity HOW TO USE JEST? 1 yarn add


slide-1
SLIDE 1

JEST: Testing Framework

Guillermo Fernández-Campoamor Fernández Carlos Manrique Enguita Elena Rodríguez Río Diego Ramírez Amandi

slide-2
SLIDE 2

WHAT IS JEST?

Jest is a JavaScript testing framework that focus on simplicity

slide-3
SLIDE 3

1 3 2

HOW TO USE JEST?

  • yarn test
  • npm run test

{ "scripts": { "test": "jest" } }

  • yarn add --dev jest
  • npm install --save-dev jest
slide-4
SLIDE 4

Jest Functionalities

  • Testing asynchronous code
  • Setup and Teardown
  • Matchers
  • Mock functions
  • Snapshop Testing
  • toBe
  • toEqual
  • not.ToBe
  • toBeNull
  • ToBeDefine

expect(2+2).toBe(4);

  • toBeTruthy
  • toBeFalsy
  • toMatch
  • toContain

const tree = renderer.create(<Link page="http://www.facebook.com"> Facebook</Link>) .toJSON(); expect(tree).toMatchSnapshot(); <a className="normal" href="http://www.facebook.com"

  • nMouseEnter={[Function]}
  • nMouseLeave={[Function]} >

Facebook </a>

slide-5
SLIDE 5

STAKEHOLDERS

slide-6
SLIDE 6

1 3 2

STAKEHOLDERS

Contributors

Sponsors

Users giving money to the dev team through donations or promoting to Backer role. Helping solving issues on Jest

  • pen github repository
  • Final Users
  • Open-Source Community
  • Facebook
  • Dev Team
  • Sponsors
slide-7
SLIDE 7

Main Focus of Interest

Developer Community Dev Team Money Contributions

slide-8
SLIDE 8

ANYONE CAN CONTRIBUTE TO THE PROJECT

slide-9
SLIDE 9

ANYONE CAN CONTRIBUTE TO THE PROJECT

slide-10
SLIDE 10

ANYONE CAN CONTRIBUTE TO THE PROJECT

slide-11
SLIDE 11

EVEN YOU

slide-12
SLIDE 12

QUALITY ATTRIBUTES

slide-13
SLIDE 13

1 3 2

QUALITY ATTRIBUTES

RELIABILITY

MAINTAINABILITY

PERFORMANCE EFFICIENCY

We want good performance for our tests Save costs Tests must be trustable

slide-14
SLIDE 14

JEST ARCHITECTURE

slide-15
SLIDE 15

How is the code organized?

slide-16
SLIDE 16

Jest-cli jest Jest-config 1 2 Jest-haste-map 3 Jest-worker 4 5 6 watchmen SearchSource TestSequencer TestScheduler Jest-worker Jest-runner Jest-jasmine2 Jest-circus Jest-runtime Jest-environment vm 7 8 9 10 11 12 puppeter

slide-17
SLIDE 17

Jest-cli jest Jest-config 1 2 Jest-haste-map 3 Jest-worker 4 5 6 watchmen SearchSource TestSequencer TestScheduler Jest-worker Jest-runner Jest-jasmine2 Jest-circus Jest-runtime Jest-environment vm 7 8 9 10 11 12 puppeter

Prior to the test itself The testing

slide-18
SLIDE 18

Jest-cli jest Jest-config 1 2 Jest-haste-map 3 Jest-worker 4 5 6 watchmen SearchSource TestSequencer TestScheduler Jest-worker Jest-runner Jest-jasmine2 Jest-circus Jest-runtime Jest-environment vm 7 8 9 10 11 12 puppeter

Prior to the test itself

slide-19
SLIDE 19

Jest-cli jest Jest-config 1 2 Jest-haste-map 3 Jest-worker 4 5 6 watchmen SearchSource TestSequencer TestScheduler Jest-worker Jest-runner Jest-jasmine2 Jest-circus Jest-runtime Jest-environment vm 7 8 9 10 11 12 puppeter

The testing

slide-20
SLIDE 20

Jest-cli jest Jest-config 1 2 Jest-haste-map 3 Jest-worker 4 5 6 watchmen SearchSource TestSequencer TestScheduler Jest-worker Jest-runner Jest-jasmine2 Jest-circus Jest-runtime Jest-environment vm 7 8 9 10 11 12 puppeter

The testing

slide-21
SLIDE 21

Jest-cli jest Jest-config 1 2 Jest-haste-map 3 Jest-worker 4 5 6 watchmen SearchSource TestSequencer TestScheduler Jest-worker Jest-runner Jest-jasmine2 Jest-circus Jest-runtime Jest-environment vm 7 8 9 10 11 12 puppeter

The testing

slide-22
SLIDE 22

CONTRIBUTE

slide-23
SLIDE 23

How to contribute

Take a look to:

  • Facebook Open Source CoC
  • Contributing guide of Jest
slide-24
SLIDE 24

Other considerations

Code conventions:

  • 2 spaces for indentation
  • 80 char line length
  • ‘ over “
  • Use TypeScript
slide-25
SLIDE 25

COMPILE JEST

slide-26
SLIDE 26

Run

How do we compile Jest?

Install:

  • Yarn
  • Python (2.7)
  • Node.js (12.x)

OR

yarn link jest-cli yarn unlink jest-cli

slide-27
SLIDE 27

JEST COMMUNITY

slide-28
SLIDE 28

Jest Community and extensions

slide-29
SLIDE 29

Visual Studio Code extension

Show individual fail / passes inline Highlights the errors next to the expect functions Help debug jest tests in vscode Starts Jest automatically

Features

slide-30
SLIDE 30

Jest-extended

npm install --save-dev jest-extended

Provides new matchers (assertions) to ease testing

slide-31
SLIDE 31

CONCLUSION