An Interest In:
Web News this Week
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
March 23, 2022 10:15 pm GMT
Original Link: https://dev.to/behzadam/illustrated-snapshot-testing-45h9
Illustrated Snapshot Testing
First, I want to say that for many cases you dont need to use snapshot testing. You can find a good article here: What Are Proper Use Cases For Snapshot Testing React Components?.
Second, if you are interested in software quality and testing then it is better to know about tools and concepts although some of them are rarely used.
Let's take a look at how snapshot testing works ( example is in Jest ):expect(component).toMatchSnapshot();
Some tips:
- Visual regression testing tools take screenshots of web pages and compare the resulting images pixel by pixel.
- With Snapshot testing values are serialized, stored within text files, and compared using a diff algorithm and this is why it's made.
- Commit snapshots and review them as part of your regular code review process.
Resources:
Jest Snapshot Testing
Youtube
Snapshot testing React components with Jest
Original Link: https://dev.to/behzadam/illustrated-snapshot-testing-45h9
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To