• 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()
    

  • 相关阅读:
    ORA-28001 has expired错误密码过期问题
    Oracle数据库无用户名密码登录
    使用Navicat连接Oracle数据库出现12541或者28547错误代码
    Solr的helloWord程序
    JS工具方法
    python发送邮件
    jmeter的性能监控框架搭建记录(Influxdb+Grafana+Jmeter)
    spotlight on mysql 监控
    linux下安装python环境
    yum的方式搭建mysql
  • 原文地址:https://www.cnblogs.com/1510152012huang/p/10685095.html
Copyright © 2020-2023  润新知