jest testing framework
play

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


  1. JEST: Testing Framework Guillermo Fernández-Campoamor Fernández Carlos Manrique Enguita Elena Rodríguez Río Diego Ramírez Amandi

  2. WHAT IS JEST? Jest is a JavaScript testing framework that focus on simplicity

  3. HOW TO USE JEST? 1 yarn add --dev jest • npm install --save-dev jest • 2 { "scripts": { "test": "jest" } } yarn test • 3 npm run test •

  4. Jest Functionalities • Testing asynchronous code toBe • toBeTruthy • toEqual • • Setup and Teardown toBeFalsy • not.ToBe • toMatch • toBeNull • toContain • ToBeDefine • • Matchers expect(2+2).toBe(4); <a className="normal" href="http://www.facebook.com" • Mock functions onMouseEnter={[Function]} onMouseLeave={[Function]} > Facebook </a> • Snapshop Testing const tree = renderer.create(< Link page="http://www.facebook.com"> Facebook</ Link >) .toJSON(); expect(tree).toMatchSnapshot();

  5. STAKEHOLDERS

  6. Contributors STAKEHOLDERS 1 Final Users • Helping solving issues on Jest Open-Source Community • open github repository Facebook • Dev Team • Sponsors • 2 Users giving money to the dev team through donations or promoting to Backer role. 3 Sponsors

  7. Main Focus of Interest Developer Dev Team Community Money Contributions

  8. ANYONE CAN CONTRIBUTE TO THE PROJECT

  9. ANYONE CAN CONTRIBUTE TO THE PROJECT

  10. ANYONE CAN CONTRIBUTE TO THE PROJECT

  11. EVEN YOU

  12. QUALITY ATTRIBUTES

  13. QUALITY ATTRIBUTES 1 PERFORMANCE EFFICIENCY We want good performance for our tests 2 MAINTAINABILITY Save costs RELIABILITY 3 Tests must be trustable

  14. JEST ARCHITECTURE

  15. How is the code organized?

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

  17. 1 Jest-cli 7 jest SearchSource 8 Jest-config 3 2 TestSequencer 9 6 Jest-haste-map TestScheduler watchmen The testing 10 5 4 Jest-runner Jest-worker Jest-worker Prior to the puppeter 11 test itself 12 Jest-jasmine2 Jest-runtime vm Jest-circus Jest-environment

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

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

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

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

  22. CONTRIBUTE

  23. How to contribute Take a look to: • Facebook Open Source CoC • Contributing guide of Jest

  24. Other considerations Code conventions: 2 spaces for indentation • 80 char line length • ‘ over “ • Use TypeScript • … •

  25. COMPILE JEST

  26. How do we compile Jest? Install: Yarn • Python (2.7) • Node.js (12.x) • Run OR yarn link jest-cli yarn unlink jest-cli

  27. JEST COMMUNITY

  28. Jest Community and extensions

  29. Visual Studio Code extension Features Starts Jest automatically Show individual fail / passes inline Highlights the errors next to the expect functions Help debug jest tests in vscode

  30. Jest-extended Provides new matchers (assertions) to ease testing npm install --save-dev jest-extended

  31. CONCLUSION

Recommend


More recommend