P
P
Pavel Gogolinsky2016-07-20 19:41:28
Yii
Pavel Gogolinsky, 2016-07-20 19:41:28

How to distinguish between unit tests and acceptance tests?

Online store tests. There is one test database and one development database. Only two test items have been added to the test database.
Unit tests are running great. I write acceptance tests using selenium. The site opens in firefox, I go to the list of products. Products are shown from the development database (not from the test database). I put one item in the cart and save the order. At the same time, an order with a product ID is created in the test database, which is not in the test database, since it was taken from the development database. And when I try to get the names of the goods in the created order in the test, I get an exception try to get property on none object.
How to act in such situations?

Answer the question

In order to leave comments, you need to log in

2 answer(s)

Сделать два разных окружения - для Unit и для acceptance тестов.
Самое простое - две раздельные виртуальные машины. Если сложнее - брать тот же Docker

A
Alexej Simakov, 2016-07-25
@lxsmkv

Acceptance testing, in principle, should not compare identifiers, otherwise it is no longer a black box. I would store the textual product name before adding it to the cart and compare it with the name after adding it to the cart. After all, the numbered identifier of the goods has no practical meaning for the user. From the point of view of the client, it will be a mistake if he adds tomatoes, but there are watermelons in the basket.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question