Más contenido relacionado Конфиги вместо костылей. Pytestconfig и зачем он нужен2. КТО ТАКАЯ Я
• Юля
• 5+ лет в ручном тестировании,
• 2 года в автоматизации (Java, NodeJS, Python)
• Тестировала веб, десктоп и мобилки в
стартапах и интеграторах
• А сейчас - Ламода
3. ЧТО ТАКОЕ LAMODA
~ 11 млн. покупателей
Бесконечно длинный, больше 60
штук, список проектов Ламоды,
среди которых скромно так
затесался мой горячо любимый
AB-testing API, а остальные
сегодня не особо-то важны
WE CODE THE FASHION
± 300 сотрудников в IT
4. ЧТО ТАКОЕ LAMODA
~ 11 млн. покупателей
Бесконечно длинный, больше 60
штук, список проектов Ламоды,
среди которых скромно так
затесался мой горячо любимый
AB-testing API, а остальные
сегодня не особо-то важны
WE CODE THE FASHION
± 250 сотрудников в IT
5. ЧТО ТАКОЕ LAMODA
~ 11 млн. покупателей
Бесконечно длинный, больше 60
штук, список проектов Ламоды,
среди которых скромно так
затесался мой горячо любимый
AB-testing API, а остальные
сегодня не особо-то важны
WE CODE THE FASHION
± 250 сотрудников в IT
17. ВАРИАНТЫ РЕШЕНИЯ
1. Отдельный проект
a. Это просто
b. Это безопасно
c. Это лень
2. Allure @allure.severity(pytest.allure.severity_level.CRITICAL)
#terminal
>>pytest rnd.tests/ --allure_severities=critical
18. ВАРИАНТЫ РЕШЕНИЯ
1. Отдельный проект
a. Это просто
b. Это безопасно
c. Это лень
2. Allure
a. Это просто
b. Это безопасно @allure.severity(pytest.allure.severity_level.CRITICAL)
#terminal
>>pytest rnd.tests/ --allure_severities=critical
20. ВАРИАНТЫ РЕШЕНИЯ
1. Отдельный проект
a. Это просто
b. Это безопасно
c. Это лень
2. Allure
a. Это просто
b. Это безопасно (не очень)
c. Это тоже лень
@allure.severity(pytest.allure.severity_level.CRITICAL)
#terminal
>>pytest rnd.tests/ --allure_severities=critical
21. ВАРИАНТЫ РЕШЕНИЯ
1. Отдельный проект
a. Это просто
b. Это безопасно
c. Это лень
2. Allure
a. Это просто
b. Это безопасно (не очень)
c. Это тоже лень
22. ВАРИАНТЫ РЕШЕНИЯ
1. Отдельный проект
a. Это просто
b. Это безопасно
c. Это лень
2. Allure
a. Это просто
b. Это безопасно (не очень)
c. Это тоже лень
3. Pytest config
23. ВАРИАНТЫ РЕШЕНИЯ
1. Отдельный проект
a. Это просто
b. Это безопасно
c. Это лень
2. Allure
a. Это просто
b. Это безопасно (не очень)
c. Это тоже лень
3. Pytest config
a. Это просто
b. Это безопасно
c. Это действительно просто
33. КАК РАБОТАЕТ PYTEST
1. Configuration
>> pytest rnd.tests/ --environment = preprod
1) строка запуска
2) conftest.py
34. КАК РАБОТАЕТ PYTEST
1. Configuration
>> pytest rnd.tests/ --environment = preprod
1) строка запуска
2) conftest.py
3) строка запуска ещё раз
36. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
>> pytest rnd.tests/ --environment = preprod
1) фикстуры
37. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
>> pytest rnd.tests/ --environment = preprod
1) фикстуры
2) тесты
38. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
>> pytest rnd.tests/ --environment = preprod
1) фикстуры
2) тесты
3) очистка
39. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
40. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
41. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
56. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
57. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
63. PYTEST.CONFIG
#output
<CmdOptions {'keyword': '', 'markexpr': '', 'maxfail': 0, 'continue_on_collection_errors': False, 'confcutdir':
None, 'noconftest': False, 'keepduplicates': False, 'basetemp': None, 'verbose': 0, 'quiet': 0, 'reportchars': '',
'disablepytestwarnings': False, 'showlocals': False, 'tbstyle': 'auto', 'fulltrace': False, 'color': 'auto',
'durations': None, 'showfixtures': False, 'show_fixtures_per_test': False, 'importmode': 'prepend', 'capture':
'fd', 'runxfail': False, 'pastebin': None, 'plugins': [], 'traceconfig': False, 'debug': False, 'assertmode':
'rewrite', 'xmlpath': None, 'junitprefix': None, 'resultlog': None, 'doctestmodules': False, 'doctestreport':
'udiff', 'doctestglob': [], 'doctest_ignore_import_errors': False, 'allurereportdir': None, 'allureseverities': {},
'allurefeatures': {}, 'allurestories': {}, 'environment': 'qa', 'markers': False, 'strict': False, 'inifilename': None,
'usepdb': False, 'usepdb_cls': None, 'lf': False, 'failedfirst': False, 'cacheshow': False, 'cacheclear': False,
'collectonly': False, 'pyargs': False, 'ignore': None, 'version': False, 'help': False, 'override_ini': None,
'setuponly': False, 'setupshow': False, 'setupplan': False, 'file_or_dir': ['rnd_tests/tests/try_test.py']}>
#content of try_test.py
def test_view_config(pytestconfig):
print(pytestconfig.option)
assert False
64. PYTEST.CONFIG
#output
<CmdOptions {'keyword': '', 'markexpr': '', 'maxfail': 0, 'continue_on_collection_errors': False, 'confcutdir':
None, 'noconftest': False, 'keepduplicates': False, 'basetemp': None, 'verbose': 0, 'quiet': 0, 'reportchars': '',
'disablepytestwarnings': False, 'showlocals': False, 'tbstyle': 'auto', 'fulltrace': False, 'color': 'auto',
'durations': None, 'showfixtures': False, 'show_fixtures_per_test': False, 'importmode': 'prepend', 'capture':
'fd', 'runxfail': False, 'pastebin': None, 'plugins': [], 'traceconfig': False, 'debug': False, 'assertmode':
'rewrite', 'xmlpath': None, 'junitprefix': None, 'resultlog': None, 'doctestmodules': False, 'doctestreport':
'udiff', 'doctestglob': [], 'doctest_ignore_import_errors': False, 'allurereportdir': None, 'allureseverities': {},
'allurefeatures': {}, 'allurestories': {}, 'environment': 'qa', 'markers': False, 'strict': False, 'inifilename': None,
'usepdb': False, 'usepdb_cls': None, 'lf': False, 'failedfirst': False, 'cacheshow': False, 'cacheclear': False,
'collectonly': False, 'pyargs': False, 'ignore': None, 'version': False, 'help': False, 'override_ini': None,
'setuponly': False, 'setupshow': False, 'setupplan': False, 'file_or_dir': ['rnd_tests/tests/try_test.py']}>
#content of try_test.py
def test_view_config(pytestconfig):
print(pytestconfig.option)
assert False
71. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
72. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
73. 2. COLLECTION
a. skip/skipif #content of test_preprod.py
@pytest.mark.skipif(pytest.config.option.environment== 'qa',
reason = 'Preprodtest')
def test_preprod(some_fixture):
assert False
74. 2. COLLECTION
a. skip/skipif #content of test_preprod.py
@pytest.mark.skipif(pytest.config.option.environment== 'qa',
reason = 'Preprodtest')
def test_preprod(some_fixture):
assert False
75. 2. COLLECTION
a. skip/skipif #content of test_preprod.py
@pytest.mark.skipif(pytest.config.option.environment== 'qa',
reason = 'Preprodtest')
def test_preprod(some_fixture):
assert False
#content of test_qa.py
@pytest.mark.skipif(pytest.config.option.environment== ’preprod',
reason = ’QA test')
def test_qa(some_fixture):
assert False
76. 2. COLLECTION
a. skip/skipif #content of test_preprod.py
@pytest.mark.skipif(pytest.config.option.environment== 'qa',
reason = 'Preprodtest')
def test_preprod(some_fixture):
assert False
#content of test_qa.py
@pytest.mark.skipif(pytest.config.option.environment== ’preprod',
reason = ’QA test')
def test_qa(some_fixture):
assert False
77. 2. COLLECTION
a. skip/skipif
b. --m/mark #content of test_preprod.py
@pytest.mark.smoke
def test_preprod(some_fixture):
assert False
#terminal
>>pytest rnd_tests --m 'smoke'
78. 2. COLLECTION
a. skip/skipif
b. --m/mark #content of test_preprod.py
@pytest.mark.smoke
def test_preprod(some_fixture):
assert False
#terminal
>>pytest rnd_tests --m 'smoke'
>>pytest rnd_tests --m 'not smoke'
79. 2. COLLECTION
a. skip/skipif
b. --m/mark #content of test_preprod.py
@pytest.mark.smoke
def test_preprod(some_fixture):
assert False
#terminal
>>pytest rnd_tests --m 'smoke'
>>pytest rnd_tests --m 'not smoke'
82. PYTEST.CONFIG
#output
<CmdOptions {'keyword': '', 'markexpr': '', 'maxfail': 0, 'continue_on_collection_errors': False, 'confcutdir':
None, 'noconftest': False, 'keepduplicates': False, 'basetemp': None, 'verbose': 0, 'quiet': 0, 'reportchars': '',
'disablepytestwarnings': False, 'showlocals': False, 'tbstyle': 'auto', 'fulltrace': False, 'color': 'auto',
'durations': None, 'showfixtures': False, 'show_fixtures_per_test': False, 'importmode': 'prepend', 'capture':
'fd', 'runxfail': False, 'pastebin': None, 'plugins': [], 'traceconfig': False, 'debug': False, 'assertmode':
'rewrite', 'xmlpath': None, 'junitprefix': None, 'resultlog': None, 'doctestmodules': False, 'doctestreport':
'udiff', 'doctestglob': [], 'doctest_ignore_import_errors': False, 'allurereportdir': None, 'allureseverities': {},
'allurefeatures': {}, 'allurestories': {}, 'environment': 'qa', 'markers': False, 'strict': False, 'inifilename': None,
'usepdb': False, 'usepdb_cls': None, 'lf': False, 'failedfirst': False, 'cacheshow': False, 'cacheclear': False,
'collectonly': False, 'pyargs': False, 'ignore': None, 'version': False, 'help': False, 'override_ini': None,
'setuponly': False, 'setupshow': False, 'setupplan': False, 'file_or_dir': ['rnd_tests/tests/try_test.py']}>
#content of try_test.py
def test_view_config(pytestconfig):
print(pytestconfig.option)
assert False
83. PYTEST.CONFIG
#output
<CmdOptions {'keyword': '', 'markexpr': '', 'maxfail': 0, 'continue_on_collection_errors': False, 'confcutdir':
None, 'noconftest': False, 'keepduplicates': False, 'basetemp': None, 'verbose': 0, 'quiet': 0, 'reportchars': '',
'disablepytestwarnings': False, 'showlocals': False, 'tbstyle': 'auto', 'fulltrace': False, 'color': 'auto',
'durations': None, 'showfixtures': False, 'show_fixtures_per_test': False, 'importmode': 'prepend', 'capture':
'fd', 'runxfail': False, 'pastebin': None, 'plugins': [], 'traceconfig': False, 'debug': False, 'assertmode':
'rewrite', 'xmlpath': None, 'junitprefix': None, 'resultlog': None, 'doctestmodules': False, 'doctestreport':
'udiff', 'doctestglob': [], 'doctest_ignore_import_errors': False, 'allurereportdir': None, 'allureseverities': {},
'allurefeatures': {}, 'allurestories': {}, 'environment': 'qa', 'markers': False, 'strict': False, 'inifilename': None,
'usepdb': False, 'usepdb_cls': None, 'lf': False, 'failedfirst': False, 'cacheshow': False, 'cacheclear': False,
'collectonly': False, 'pyargs': False, 'ignore': None, 'version': False, 'help': False, 'override_ini': None,
'setuponly': False, 'setupshow': False, 'setupplan': False, 'file_or_dir': ['rnd_tests/tests/try_test.py']}>
#content of try_test.py
def test_view_config(pytestconfig):
print(pytestconfig.option)
assert False
84. PYTEST.CONFIG
#content of try_test.py
def test_view_config(pytestconfig):
print(pytestconfig.option)
assert False
#output with –m = 'smoke'
<CmdOptions {'keyword': '', 'markexpr': 'smoke', 'maxfail': 0, 'continue_on_collection_errors': False,
'confcutdir': None, 'noconftest': False, 'keepduplicates': False, 'basetemp': None, 'verbose': 0, 'quiet': 0,
'reportchars': '', 'disablepytestwarnings': False, 'showlocals': False, 'tbstyle': 'auto', 'fulltrace': False, 'color':
'auto', 'durations': None, 'showfixtures': False, 'show_fixtures_per_test': False, 'importmode': 'prepend',
'capture': 'fd', 'runxfail': False, 'pastebin': None, 'plugins': [], 'traceconfig': False, 'debug': False,
'assertmode': 'rewrite', 'xmlpath': None, 'junitprefix': None, 'resultlog': None, 'doctestmodules': False,
'doctestreport': 'udiff', 'doctestglob': [], 'doctest_ignore_import_errors': False, 'allurereportdir': None,
'allureseverities': {}, 'allurefeatures': {}, 'allurestories': {}, 'environment': 'qa', 'markers': False, 'strict': False,
'inifilename': None, 'usepdb': False, 'usepdb_cls': None, 'lf': False, 'failedfirst': False, 'cacheshow': False,
'cacheclear': False, 'collectonly': False, 'pyargs': False, 'ignore': None, 'version': False, 'help': False,
'override_ini': None, 'setuponly': False, 'setupshow': False, 'setupplan': False, 'file_or_dir':
['rnd_tests/tests/try_test.py']}>
85. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
86. КАК РАБОТАЕТ PYTEST
1. Configuration
2. Collection
3. Running
4. Reporting
>> pytest rnd.tests/ --environment = preprod
92. В ИДЕАЛЬНОМ МИРЕ
1. Настроен раздельный запуск тестов для разных сред
2. Исключены человеческие ошибки при запуске
3. Добавлен минимум кода
4. Добавлено 0 дополнений
93. В ИДЕАЛЬНОМ МИРЕ
1. Настроен раздельный запуск тестов для разных сред
2. Исключены человеческие ошибки при запуске
3. Добавлен минимум кода
4. Добавлено 0 дополнений