Python Unit Testing With Pytest 2 - Using Options with Pytest

preview_player
Показать описание
In this Python Unit Testing With PyTest video I am going to show you How to use Options with pytest:
How to run cases?
• pytest tests/
• pytest -k match # def test_match():
-k EXPRESSION only run tests which match the given substring expression.
• pytest --showlocals # trace context
• pytest -x # stop on first failure case
• pytest --maxfail=2 # on the second
• pytest -s # enable `print` output
• pytest --durations=5 # list top 5 slowest cases
• pytest --tb=long # default traceback
• pytest --tb=line # oneline
• pytest --tb=short
• pytest --tb=native # Python default traceback
-m MARKEXPR only run tests matching given mark expression.
example: -m 'mark1 and not mark2'.
--markers show markers (builtin, plugin and per-project ones).
-x, --exitfirst exit instantly on first error or failed test.
--maxfail=num exit after first num failures or errors.

What is Unit Testing - According to wikipedia, unit testing is a software testing method by which individual units of source code are tested to determine whether they are fit for use.

Why Unit Test? -
Tests Reduce Bugs in New Features and Existing Features
Tests Are Good Documentation
Tests Reduce the Cost of Change
Faster Debugging
Faster Development
Better Design

Python Testing frameworks
unittest - In the Python Standard Library
nose - Not in the Standard Library. Simpler tests than unittest
pytest - Not in the Python Standard Library.

run with following command:
or

#PythonTutorialforBeginners #ProgrammingKnowledge #PyTest #PythonCourse.
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Рекомендации по теме
Комментарии
Автор

Can you make video on SELENIUM Webdriver with PYTEST Framework

Indian-fhhf
Автор

why do i get a warning on @pytest.mark.number when running "pytest -v -m number" ?

PytestUnknownMarkWarning,
...

ulfgj
visit shbcf.ru