Manjula Dube

Senior Developer @Bookmyshow

Organizer @Mumbai Women Coders

Google Developer Group - Mumbai Chapter

@manjula_dube

Do you really test?

We just love the

IDEA OF TESTING

Existing Problems

Text

More Effort => Less Tests

Less Effort => More Tests

Text

If you are writing tests:

you are already winning

If you are not writing tests:

let me encourage you to start


How do we prevent  bugs?

 

Text

1.  Flow -Static Type Checker

Text

Text

2. Linting: ESLint

3. Testing?????

 Testing?

Catch some bugs before they can happen...

Text

Write better code

Stability

Executable documentation

What kinds of testing can we do?

Text

Usability Testing

Performance Testing

Penetration Testing

Integration Testing

E2E Testing

Regression Testing

Smoke Testing

Unit Testing

Fuzz Testing

Stress Testing

Text

  • Tape

TOOLS/FRAMEWORKS

Text

Ch

  • Chai
  • Cucumber
  • Mocha
  • Ava
  • Enzyme
  • Jasmine
  • Sinon

Function

COMPONENTS

REDUCERS

ACTIONS

Unit testing in React app?

 JEST

Text

Text

How do we test our react components?

Why Jest?

Zero Configuration

Instant run

Text

Text

Snapshot testing

Code coverage

Interactive watch mode

Setting up Jest

 

npm install --save-dev jest

OR

yarn add --dev jest

Text

What is Snapshot Testing?

How does snapshot work?

Snapshots Benefits

Automate process, to manage snapshots

Adapt changes

Text

Easy to  maintain

Lets test the Action button component on BookMyShow.

Text

<ActionButton/>

Text

FUTURE Scope of jest

  • Browser snapshots—   This will get snapshots by rendering your UI on a real browser.

Text

  • Image snapshots —   This will get snapshots as images so we can test CSS and style changes as well.

Text

Text

Future Shines

Jest v/s Enzyme?

Enzyme is a javascript testing utility for React that makes it easier to assert, manipulate, and traverse your React Components' output.

 Shortcomings of using jest.

Merge conflicts

Overuse

You can’t TDD

Text

 Logical bugs can still persist based on varying app behaviours.

Text

How testing helped us?

Should I use them or not?

Thankyou

@manjula_dube

Convinced you to write more of test cases

Happy testing :)

https://medium.com/@manjuladube

React Testing Slide Deck

By manjula dube

React Testing Slide Deck

Why testing is important? & Right way to test react components

  • 2,377