R
R
Roman Yakimchuk2020-12-16 00:36:31
Software testing
Roman Yakimchuk, 2020-12-16 00:36:31

Why is Enzyme needed?

Hello everyone

Today I caught myself on a rather interesting thought - why do we need Enzyme at all?

Enzyme is just a way to test the behavior and content of a component's markup under various conditions. That's all, as far as I understand.

Thus, when we test components, we create an environment, create a component, and check that it behaved or rendered correctly. To do this, we create stubs, mocks, proxy objects, and check the nodes.

As a result, functional testing also checks the behavior of the component, but related to the target user scenarios. Without stubs, proxy objects and other things, we will still check that the system and components work correctly in the scenarios we need, because if the integration is broken, the application will break.

Thus, Enzyme tests are ultimately just an analogue of functional tests.
Therefore, the question is, why write both Enzyme "units" and functional tests at the same time?

So far I can see the advantages:
1. The ability to comprehensively test the operation of the component
2. The testing speed is much higher

On the other hand, functional testing is a hundred times easier (attached to the selector, and that's it; IMHO).

Your thoughts?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Lewandowski, 2020-12-16
@vovaspace

For example, you are developing a library of components and you need to test each component separately.
You're right, speed.
If you don't like the approach of testing the internals of a component, take a look at the React Testing Library .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question