W
W
WebDev2020-05-27 12:00:19
PHP
WebDev, 2020-05-27 12:00:19

A practical guide to writing tests?

Hello!
Please tell me an intelligent resource (textbook, article, video) on how to properly test the application.
There is a working site with good traffic, but there are no tests. It became scary to spread new features if they are a little more complicated than primitive ones. The site is quite voluminous - backend on Laravel and client on Vue.
Tell me, how can a person who has never written tests cover a finished project with tests and sleep peacefully?
I looked at a lot of materials, everywhere there are such tests:

assertTrue(1 === 1);
assertFalse(2 === 1);

Maybe there is more detailed material on where to test, how to test, why test this way, etc.?
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maksim Fedorov, 2020-05-27
@Maksclub

Since the project is combat, you will have to do it differently than in textbooks:
- First, you will need to write acceptance / functional tests (as unit tests will most likely be out of place, and it will take a long time to cover all cases) on critical places and those on that you can reach
- New features should be covered with units as much as possible, and along the way, old cases that are affected by the changes. Where units are not possible - make functional
ones - Try to make tests for places that change
- Help tests: write code with declare(strict_types=1) so that the code itself tests partly and is confident in the arguments, write code simpler and more
reliable practical aspects - well, there are many nuances, entire textbooks
Separately:
- Take Codeception as an example as a test full-stack framework
- Learn from me for example :) (in private)

D
Daniil Rudnev, 2020-05-27
@10435780

for example

E
Egor Ommonik, 2020-05-27
@Ommonick

It’s worth starting with the question “what to test?” (that is, about test design)
and ending with the question “how to test” (technologies)
Conditionally highlight the key functionality of your application.
for example, if this is a blog, then a short checklist by category is something like this: Users
:
Registration
Authorization
Password change / recovery
Social part:
publishing messages
comments on messages
privacy settings
next regression test.
After that, automate boring / massive scripts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question