Pytest(function has test keyword)

decorators
fixtures
markers
params
assert



pip install pytest
pytest --version

Rules:
Test files start with test_ or end with _test.py
Test functions start with test_

Different options to run:
Run all tests in current directory - pytest
Run a specific file                - pytest test_sample.py
Run a specific test function       - pytest test_sample.py::test_addition


Verbose output - pytest -v
Stop on Failure - pytest -x
Show print statemnts - pytest -s
Run test matching keyword - pytest -k "add"

#report Generation
pytest --junitxml=report.xml
#html report
pip install pytest-html
pytest --html=report.html

#Markers : pytest -m smoke
import pytest
@pytest.mark.smoke
def test_smoke():
    assert True

#Fixtures : 
import pytest
@pytest.fixture
def setup_data():
    return {"env": "test"}
def test_env(setup_data):
    assert setup_data["env"] == "test"