Skip to content

Add test status in automation test in Pytest on LambdaTest

Notifications You must be signed in to change notification settings

LambdaTest/Pytest-add-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

How to add test status in automation test in Pytest on LambdaTest

If you want to add test status in automation test in Pytest on LambdaTest, you can follow the below steps. You can refer to sample test repo here.

Configure conftest.py

The driver function in conftest.py has to add "lambda-status" as "passed" or "failed" based on the execution. Add the below code to your driver function (refer to conftest.py):

    def fin():
        #browser.execute_script("lambda-status=".format(str(not request.node.rep_call.failed if "passed" else "failed").lower()))
        if request.node.rep_call.failed:
            browser.execute_script("lambda-status=failed")
        else:
            browser.execute_script("lambda-status=passed")
            browser.quit()
    request.addfinalizer(fin)

Run your test

cd tests //navigate to tests directory
python sample_todo.py

Links:

LambdaTest Community

About

Add test status in automation test in Pytest on LambdaTest

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published