GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — auto_testing/ddt_testing.py at master · davidway/auto_testing Expand file tree/ Copy pathddt_testing.pyMore file actions 61 lines (51 loc) · 1.36 KB / Copy pathddt_testing.pyFile metadata and controls61 lines (51 loc) · 1.36 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 import os from appium import webdriver import time from email.header import Header from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart import smtplib from ddt import ddt, data from pymysql import connect import unittest def getMySQLTestData(): # 查询数据库的方法 try: db = connect(host="localhost", user="root", password="123456", db="test", port=3306, charset="utf8") # 打开数据库连接 cur = db.cursor() # 使用cursor()方法获取操作游标 sql = "SELECT `username`, `password` FROM user;" # sql语句 cur.execute(sql) # 执行sql语句 results = cur.fetchall() # 获取查询的结果 db.commit() # 提交 cur.close() # 关闭游标 db.close() # 断开数据库连接 return results # 返回一个list except Exception as e: print(e) @ddt # ddt驱动 class MyTestCase(unittest.TestCase): def setUp(self): pass @data(*getMySQLTestData()) def test_something(self, sqlTestData): username, password = sqlTestData print(username,"密码是",password) def tearDown(self): pass if __name__ == '__main__': unittest.main() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |