I'm using pytest and selenium. When I try run my test script:
import pytest
from selenium import webdriver
from pages import *
from locators import *
from selenium.webdriver.common.by import By
import time
class RegisterNewInstructor:
def setup_class(cls):
cls.driver = webdriver.Firefox()
cls.driver.get("http://mytest.com")
def test_01_clickBecomeTopButtom(self):
page = HomePage(self.driver)
page.click_become_top_button()
self.assertTrue(page.check_instructor_form_page_loaded())
def teardown_class(cls):
cls.driver.close()
The message shown is: no tests ran in 0.84 seconds
Could someone help me run this simple test?
According to the pytest
test conventions, your class should start with Test
to be automatically picked up by the test discovery mechanism. Call it TestRegisterNewInstructor
instead.
Or, subclass the unittest.TestCase
:
import unittest
class RegisterNewInstructor(unittest.TestCase):
# ...
Also keep in mind that the .py test script itself must begin with test_
or end with _test
in its filename.
As simple as it looks:
test_*.py
or *_test.py
.test
prefix.Find more about the pytest conventions here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With