[CentralOH] pytest and selenium

John Cassidy jocassid at gmail.com
Fri Dec 23 15:04:56 EST 2016


I'm testing a website using selenium and pytest.  I have some tests
functions involving the various search features on the site.  I also had a
test where selenium accesses the sites login page and logs in.  When
running all tests in the module the login test would run first and the user
would be logged in for the other tests.  The problem is that if I try to
run an individual test then the login doesn't take place.

How would I handle something like logging in within the pytest framework?
I'd like to avoid doing a login as part of every test and would still like
to be able to run tests individually.

I've thought of writing the login as a fixture.  To log in I need the
selenium webdriver which I've written a fixture for and the base url which
I also have a fixture for.  I'm not sure how to handle the fixture
depending on other fixtures.

Any thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20161223/31d805b3/attachment.html>


More information about the CentralOH mailing list