Create the first script using pytest

Hope you're installed pytest package as mentioned in the post. In this post, we're going to create a sample pytest.

As a first step, create a file named and copy the below code snippet to it
import pytest
def test_test1():
 assert a == b,"test failed"
def test_test2():
 assert x == y,"test failed"
As a second step, using command prompt navigate to the script path and execute below command to run the script
pytest -vv -ss
Yes!!!, you've executed the first script and its results are displayed.

Share this