zoukankan      html  css  js  c++  java
  • 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()
    

      运行后显示:

    我的解决办法是:测试用例以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()
    

  • 相关阅读:
    【腾讯Bugly干货分享】移动互联网测试到质量的转变
    【腾讯Bugly干货分享】微信终端跨平台组件 mars 系列(一)
    如何用手机维护Mysql数据库
    企业内网信息安全实践-记ChinaUnix技术交流
    完成《Java编程入门》初稿
    Windows Server 2012下安装Hyper-V虚拟机
    MacOSX和Windows 8的完美融合
    Iphone5S 体验(视频+截图)
    PC上安装MAC X Lion
    正宗PC Unix实验环境
  • 原文地址:https://www.cnblogs.com/1510152012huang/p/10685095.html
Copyright © 2011-2022 走看看