Skip to content

first try - #1

Open
Katesen1 wants to merge 4 commits into
mainfrom
develop
Open

first try#1
Katesen1 wants to merge 4 commits into
mainfrom
develop

Conversation

@Katesen1

Copy link
Copy Markdown
Owner

No description provided.

Comment thread tests/test_create_courier.py Outdated
@allure.title('Проверка создания курьера')
def test_create_courier(self):
response = create_courier.register_new_courier()
assert response.status_code == 201 and response.text == '{"ok":true}'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: необходимо очищать базу и удалять пользователя после выполнения тестов. Для решения этой задачи очень хорошо подойдут фикстуры

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправлено

Comment thread tests/test_create_order.py Outdated
@pytest.mark.parametrize(
"firstName, lastName, address, metroStation, phone, rentTime, deliveryDate, comment, color",
[
pytest.param(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можно лучше: очень много информации внутри теста, будет понятнее если данные для заказов будут храниться во внешнем модуле.

Также параметризация касается исключительно цвета , а не всех полей. тут нужно убрать дублирование

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправлено

Comment thread tests/test_get_list_orders.py Outdated
import allure

class TestGetListOrders:
@allure.title('Проверка списка заказов')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут не проверяется список заказов, а только статус код

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправлено

Comment thread tests/test_login.py
@pytest.mark.parametrize(
"login, password", [(data.login_registered, ""), ("", data.password_registered)]
)
def test_autorization_without_field(self, login, password):

This comment was marked as outdated.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправлено

Comment thread tests/test_create_courier.py Outdated
class TestCreateCourier:
@allure.title('Проверка создания курьера')
def test_create_courier(self):
response = create_courier.register_new_courier()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: Над каждым каждым логическим методом (запрос через requests) добавить декоратор allure.step

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

исправлено

Comment thread conftest.py Outdated
courier_id = login_response.json()["id"]
requests.delete(f"{const.BASE_URL}/api/v1/courier/{courier_id}")

return delete No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

курьера нужно удалять после теста, т.е после yield когда мы возвращаемся в фикстуру

Comment thread tests/test_create_courier.py Outdated
response, login, password = create_courier.register_new_courier()
with allure.step("Проверка статус кода ответа и тела ответа"):
assert response.status_code == 201 and response.text == '{"ok":true}'
with allure.step("Удаление тестовых данных"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

фикстуры не вызывают в тесте, нужно доработать фикстуру добавив yield и выполняя код очищения базы после.

Иначе если что то пойдет не по плану, строки написанные в конце теста могут не выполнится. Мы используем фикстуру для того чтобы попробовать очистить базу при любом исходе теста

Comment thread tests/test_create_courier.py Outdated
}
with allure.step("Первое создание курьера"):
response1 = requests.post(const.BASE_URL + const.COURIER_HANDLE, data=payload)
if response1.status_code == 201:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

вот тут тест может упасть, хотя этот шаг не связан со сценарием, это именно постусловие

Comment thread tests/test_create_order.py Outdated
def test_create_order(self, color_variant):
with allure.step("Подготовка данных"):
payload = data.COMMON_ORDER_DATA
if color_variant is not None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нужно исправить: условий в тестах быть не может, тест всегда однозначен. Если это не вписывается в параметризацию, значит ее быть не должно и это просто несколько отдельных тестовых методов

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Извини что пропустила это в прошлую итерацию

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants