Your Guide for Testing ReactJS Apps - Part 1

Neha Sharma - Sep 28 '22 - - Dev Community

What is Testing

Testing is crucial for the engineers and every engineering team. Testing helps in gaining the confidence on the features devs are developing, and shipping. Gone are the days where we used to relay only on the testers for the testing and bugs.

Now, engineers are encouraged to write test-cases to avoid bugs and errors. This will increase the confidence of the developers in the product and shipping the code with quality.

Type of testing (React) & complexity

  1. Unit testing: Easy

  2. Snapshot : Easy and for UI

  3. Integration Testing: Medium

  4. End to end testing: Complex

Image description

Type of testing:

  1. TDD: Test driven development

  2. BDD: Behaviour driven development

Why testing

  1. Avoid bugs

  2. Gain confidence

  3. Proof of documentation

  4. Quality code

Library for test cases

There are 2 testing way: Assertion & test runner

  1. Jest

  2. Chai

  3. Mocha

  4. React Testing Library

  5. Puppeteer

  6. Playwright

  7. Airbnb

Autonomy of test case

Image description

Details

Image description

In next, blog we will get into the code. We will write our first test-case.

If you like this blog do follow me at Twitter

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .