A
A
Artem00712018-07-05 15:18:54
Software testing
Artem0071, 2018-07-05 15:18:54

What is the difference between the tests?

I'm learning Laravel (well, I'm trying to learn how to test something)
It has a tests folder in which there are 2 more folders: Feature and Unit
What is the difference between these tests? What should be tested where?
The documentation says:

By default, your application's tests directory contains two directories: Feature and Unit. Unit tests are tests that focus on a very small, isolated portion of your code. In fact, most unit tests probably focus on a single method. Feature tests may test a larger portion of your code, including how several objects interact with each other or even a full HTTP request to a JSON endpoint.

But what is meant by "small pieces of code" I do not really understand.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yan-s, 2018-07-05
@Artem0071

Юнит тесты - для тестирования коротких изолированных фрагментов кода, отдельных методов. Проверяем, что элементарный метод работает корректно сам по себе.
Функциональное тестирование - тестирование функционала системы. Тут проверятся что определенный запрос дает определенный ответ, приводит к определенным результам. Например, что переход пользователя по определенному адресу должен выдать HTML страницу с некими данными. Проверка работоспособности системы с точки зрения пользователя.
https://ru.wikipedia.org/wiki/%D0%9C%D0%BE%D0%B4%D...
https://ru.wikipedia.org/wiki/%D0%A4%D1%83%D0%BD%D...

K
KiT, 2018-08-31
Maverick @kit_de

Classic. The answer lies in the question.
unit test. Testing a small piece of code. Atomic testing.
feature test. Testing a specific feature.
TOTAL
Difference in functionality coverage: unit test - atomically, feature test - globally (in the context of a feature).
PS:
A small piece of code. Method. Minimal independent unit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question