unittest中的Empty suite错误

import unittest
from selenium import webdriver class ibdata(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Chrome()
cls.driver.maximize_window()
cls.driver.implicitly_wait(30)
cls.driver.get("http://www.ibdata.cn/#!/login") @classmethod
def tearDownClass(self):
self.driver.quit() def ibdata_login(self):
self.driver.find_element_by_xpath("/html/body/div/div/div[2]/div/div[1]/div[2]/div/div[2]/div[1]/div[1]/div/input").send_keys("xxxxxx")
self.driver.find_element_by_xpath("/html/body/div/div/div[2]/div/div[1]/div[2]/div/div[2]/div[1]/div[2]/div/input").send_keys("xxxxx")
self.driver.find_element_by_xpath("/html/body/div/div/div[2]/div/div[1]/div[2]/div/div[2]/div[2]/button").click() def ibdata_search(self):
pass if __name__ == "__main__":
unittest.main()

  运行后显示:

unittest中的Empty suite错误

我的解决办法是:测试用例以test开头,完美解决

class ibdata(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Chrome()
cls.driver.maximize_window()
cls.driver.implicitly_wait(30)
cls.driver.get("http://www.ibdata.cn/#!/login") @classmethod
def tearDownClass(self):
self.driver.quit() def test_login(self):
self.driver.find_element_by_xpath("/html/body/div/div/div[2]/div/div[1]/div[2]/div/div[2]/div[1]/div[1]/div/input").send_keys("1xxxx")
self.driver.find_element_by_xpath("/html/body/div/div/div[2]/div/div[1]/div[2]/div/div[2]/div[1]/div[2]/div/input").send_keys("9xxxxg")
self.driver.find_element_by_xpath("/html/body/div/div/div[2]/div/div[1]/div[2]/div/div[2]/div[2]/button").click() def test_search(self):
pass if __name__ == "__main__":
unittest.main()

unittest中的Empty suite错误

上一篇:day27 粘包及粘包的解决方案


下一篇:java基础编程——二维数组中的查找