Rafael Rafael - 3 months ago 51
Python Question

Pytest - no tests ran

Currently I'm using pytest (I'm new with this) and selenium. When I try run my 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()

def test_01_clickBecomeTopButtom(self):
page = HomePage(self.driver)

def teardown_class(cls):

Is shown the message: 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):
    # ...