Skip to content

Develop2 - #1

Open
FomenkoIS wants to merge 11 commits into
mainfrom
develop2
Open

Develop2#1
FomenkoIS wants to merge 11 commits into
mainfrom
develop2

Conversation

@FomenkoIS

Copy link
Copy Markdown
Owner

Написал тесты на API для [Stellar Burgers]
Подключил библиотеки: pytest, requests и allure-pytest.
Сделай отчёт в Allure.

@irisqul irisqul left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Сильные стороны:

  • Код запускается без ошибок
  • Проверяется тело и код отчета, там где это необходимо
  • Тестовые данные создаются перед тестом и удаляются после того, как он выполнится
  • Тестовая архитектура соответствует изученным практикам написания автотестов

from url import URL
import allure

class OrderMethods:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Отлично: создан интерфейс для взаимодействия с АПИ, код стал более управляемым

def test_create_order_with_authorization_succeed(self, random_user_data):

user_data = random_user_data
UserMethods.create_user(user_data)

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_login_user.py Outdated
user_data = random_user_data

response_create = UserMethods.create_user(user_data)
assert response_create.status_code == 200, "Не удалось создать пользователя"

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_login_user.py Outdated
user_data = random_user_data.copy()

response_create = UserMethods.create_user(user_data)
assert response_create.status_code == 200, "Не удалось создать пользователя"

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_login_user.py Outdated
user_data = random_user_data.copy()

response_create = UserMethods.create_user(user_data)
assert response_create.status_code == 200, "Не удалось создать пользователя"

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 data.py Outdated
def get_list_of_ingredients():

response = IngredientsMethods.get_ingredients()
assert response.status_code == 200, "Не удалось получить ингредиенты"

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