Python 2.7 Python上的Selenium测试结果是在0.000秒内运行0个测试
我正在用Python进行selenium测试,我在项目中有很多测试。我从linux服务器迁移到windows测试服务器(浏览器和测试在此服务器上运行)一切正常,但创建的每个新测试我都无法运行,我不知道为什么。它写入“在0.000s内运行0测试”“确定”我可以正常运行的其他测试 cmd中的两个命令(第一个失败,第二个正确):Python 2.7 Python上的Selenium测试结果是在0.000秒内运行0个测试,python-2.7,selenium,automated-tests,Python 2.7,Selenium,Automated Tests,我正在用Python进行selenium测试,我在项目中有很多测试。我从linux服务器迁移到windows测试服务器(浏览器和测试在此服务器上运行)一切正常,但创建的每个新测试我都无法运行,我不知道为什么。它写入“在0.000s内运行0测试”“确定”我可以正常运行的其他测试 cmd中的两个命令(第一个失败,第二个正确): C:\Python27\python.exe -m unittest discover ../autotesty "test_systemlive_2_4_2_6-7_ext
C:\Python27\python.exe -m unittest discover ../autotesty "test_systemlive_2_4_2_6-7_extensions.py"
C:\Python27\python.exe -m unittest discover ../autotesty "test_systemlive_2_4_2_1_new_rec_unit.py"
文件test\u systemlive\u 2\u 4\u 2\u 6-7\u extensions.py测试失败(写入cmd“在0.000s内运行0个测试”“确定”):
文件测试\u systemlive\u 2\u 4\u 2\u 1\u new\u rec\u unit.py-正确测试(这将运行浏览器,selenium完成其工作):
两个测试中的设置和拆卸都来自同一种方法——我认为这没有问题。有解决方案吗?文件名“test\u systemlive\u 2\u 4\u 2\u 6-7\u extensions.py”中是破折号(-)文件名“test\u systemlive\u 2\u 4\u 6-7\u extensions.py”中是破折号(-)Ups。。。这是因为文件名test_systemlive_2_4_2_6-7_extensions.py中的破折号。抱歉,伙计们,我仍然是Python初学者:(Ups…这是因为文件名测试中的破折号_systemlive_2_4_2_6-7_extensions.py。抱歉,伙计们,我仍然是Python初学者:(
# coding=utf-8
__author__ = 'u-zima00m1'
from lib import selenium_tools as st
import unittest
import time
class Extensions(unittest.TestCase):
def setUp(self):
st.set_up(self)
def test_13_01_extensions(self):
driver = self.driver
st.login(self, "bossboss", "Bossboss1")
st.select_roles(self, "God", "root")
st.switch_to_page(self, "System")
st.switch_to_sub_page(self, "CTI")
st.switch_to_sub_sub_page(self, "CTI Servers")
st.wait_for_element(self, "//a[@title='New']/img[@src='/experience/img-dist/New.svg']", "XPATH")
driver.find_element_by_xpath("//a[@title='New']/img[@src='/experience/img-dist/New.svg']").click()
time.sleep(1)
# Other long code ...
def tearDown(self):
st.tear_down(self)
if __name__ == "__main__":
unittest.main()
# coding=utf-8
__author__ = 'u-zima00m1'
from lib import selenium_tools as st
import unittest
import time
class NewRecUnit(unittest.TestCase):
def setUp(self):
st.set_up(self)
def test_10_01_create_RU(self):
driver = self.driver
suite = unittest.TestLoader().discover('.', pattern="rex_simulator.py")
unittest.TextTestRunner(verbosity=3).run(suite)
st.login(self, "bossboss", "Bossboss1")
st.select_roles(self, "God", "root")
st.switch_to_page(self, "System")
st.switch_to_sub_page(self, "Recording sources")
st.switch_to_sub_sub_page(self, "Recording units")
driver.find_element_by_xpath("//a[@title='New']/img[@src='/experience/img-dist/New.svg']").click()
time.sleep(1)
# Other long code ...
def tearDown(self):
st.tear_down(self)
if __name__ == "__main__":
unittest.main()