我用的是pytest和硒。当我尝试运行测试脚本时:
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()
显示的消息是:0.84秒内未运行任何测试
有人能帮我做这个简单的测试吗?
尝试在setUP和tearDown的顶部添加@classmethod。
你自己上过课吗?
在这段代码中,我看不到您显示您调用了要运行的类或定义。
例如,在python中,您运行这样的类或定义:
根据^{} test conventions ,类应该从
Test
开始,然后由测试发现机制自动获取。改称为TestRegisterNewInstructor
。或者,将
unittest.TestCase
子类划分为:还要记住,.py测试脚本本身的文件名必须以
test_
开头。相关问题 更多 >
编程相关推荐