Saturday 9 September 2017

Python | pytest | Quick tutorail

Install Pytest:

open command window at

C:\Users\PK\AppData\Local\Programs\Python\Python36-32\Scripts

pytest --version

pip install -U pytest

-------------------------------

Our first test:

GoogleTest.py

def inc(x):
    return x + 1

def test_answer():
    assert inc(3) == 5

-------------------------------
Run:

open command window at C:\Users\PK\AppData\Local\Programs\Python\Python36-32\Scripts

pytest C:\Users\PK\PycharmProjects\allure-reports-with-pytest\tests\GoogleTest.py

or

>py.test -q -s GoogleTest.py

No comments:

Post a Comment