M
M
magary42016-04-09 12:19:50
Drupal
magary4, 2016-04-09 12:19:50

How to write a test for the following functionality?

The company I worked for never experienced testing.
As I understand it, this is an indispensable thing for large projects with continuous integration.
Description of the project:
1. Content in the form of a huge tree, each content node is translated into several languages
​​2. Many different forms that send emails with some attached information, depending on the page from which the sending was made.
3.User registration, profile editing and visibility of additional site goodies if logged
in. 4.import of products. The admin feeds the xml and a huge number of products are imported to the site, some of which are sometimes lost or a couple of product attributes are lost.
How to increase the quality of this case and reduce the time of finding bugs?
My thoughts:
1. Selecting several random nodes from the database, opening them with a browser and checking for 404
2. how to fill out and submit the form is understandable, but how to check that what you need has arrived?
3. Filling out the registration form. Login. Profile editing test. What's next? Do a query in the database and see the correctness of the changes?
4. After import, it is not realistic to check all products. You can only check their number in the database and the sum of the attributes. Next, you can selectively open several product pages and check the output of the main fields and the absence of 404 images.
Correct me
In general, abstractly, when I am writing this now, there are doubts about the profit in relation to the first 3 points. After all, it basically turns out that the programmer, having made the functionality and checking it, after a while gets a bug that if you put a combination of certain characters somewhere or do some strange sequence of actions, then something does not work correctly.
Those. if he writes tests for this, then with a high probability he will cover the normal behavior of the user and again get a bug that occurs with non-trivial behavior that cannot be predicted

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2016-04-09
@sim3x

The topic is too extensive
review https://events.yandex.ru/lib/talks/535/
To reduce the time of bug detection, you should have tests for all the functionality that you have written. Those 90%+ unit
To check how all components interact you need to write functional tests - they can be written in such a style as in "My thoughts", but it's better to describe the typical behavior of a conditional user
- went to the site
- clicked
- received
symfony.com/ doc/current/book/testing.html

a bug that occurs with non-trivial behavior
such cases should be obtained from logs and user reviews - you should not get hung up on such cases

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question