R
R
RMate2019-11-22 18:06:27
PHP
RMate, 2019-11-22 18:06:27

How to write deep integration tests?

Hello!
I need to check the operation of the controller (record creation, modification, deletion).
However, the entity with which the controller works depends on another entity, which in turn depends on a third entity (for example, category -> product -> comment). A comment cannot be created until a product is created, a product cannot be created until a category is created.
What to do in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maksim Fedorov, 2019-11-22
@RMate

These functional tests are usually built on fixtures:
- the state of the system (for example, a database) is loaded to the required level, for example, the KA category and the TA product
are loaded - the application or a sufficient number of services for the test is loaded
- a test is carried out (for example, a product is added a duplicate product TA and the system must swear or a product that does not exist is removed, for example, a TB product)
And so for each case - the state is adjusted for it. It is necessary that the test should still be relatively isolated. For some tests, the state is one and the instructions for raising it will be the same. Plus, it's faster and easier.
In general, these tests are complex and therefore their number is usually much less than simple units ... In addition, sometimes it already makes sense to do this through acceptance (browser) tests

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question