Skip to content

Commit 8df8413

Browse files
author
Vant Ling
committedMay 14, 2020
[U] update 修改了整个结构
1 parent 52d4eba commit 8df8413

24 files changed

+25
-50
lines changed
 
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎test/case/case.yaml ‎data/testcase.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@ login:
22
username : admin
33
password : 111111
44

5-
login:
6-
face_url : 'http://www.*****'
7-
8-

‎report/HTMLTestRunner3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ def __init__(self, stream=sys.stdout, verbosity=1, title=None, description=None)
712712
self.startTime = datetime.datetime.now()
713713

714714
def run(self, test):
715-
"Run the given test case or test suite."
715+
"Run the given test testcase or test suite."
716716
result = _TestResult(self.verbosity)
717717
test(result)
718718
self.stopTime = datetime.datetime.now()

‎run.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
def create_suite():
1212
TestSuite = unittest.TestSuite() # 测试集
13-
test_dir = './test/case'
13+
test_dir = './test/testcase'
1414
# print(test_dir)
1515

1616
discover = unittest.defaultTestLoader.discover(

‎test/case/.pytest_cache/v/cache/lastfailed

-10
This file was deleted.

‎test/case/.pytest_cache/v/cache/nodeids

-3
This file was deleted.

‎test/case/Autolt/test1.exe

-954 KB
Binary file not shown.

‎test/case/Autolt/test1.jpg

-121 KB
Binary file not shown.

‎test/common/BrowserDriver.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
# @Author : Vant
44
# @Email : 944921374@qq.com
55

6-
import os.path
76
from selenium import webdriver
87
from utils.logger import Logger
9-
import yaml
108
from selenium.webdriver.chrome.options import Options
119
from utils.config import Config
1210

@@ -46,7 +44,7 @@ def openbrowser(self,driver):
4644
# driver = webdriver.Chrome() #用于linux系统加载驱动使用
4745
logger.info("启动谷歌浏览器")
4846
elif browser == "IE":
49-
driver = webdriver.Ie(self.ie_driver_path)
47+
driver = webdriver.Ie(self.c.driver_ptah())
5048
logger.info("启动IE浏览器")
5149

5250
driver.get(url)

‎test/common/Selenium2.py ‎test/common/Seleniums.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
# @Author : Vant
44
# @Email : 944921374@qq.com
55

6-
from selenium import webdriver
76
from selenium.webdriver.common.action_chains import ActionChains
87
from selenium.webdriver.support.select import Select
98
from selenium.common.exceptions import * #导入所有的异常类
109
from selenium.webdriver.support import expected_conditions as EC
1110
from selenium.webdriver.support.ui import WebDriverWait
12-
import os.path
1311
from utils.logger import Logger
1412
import time
1513
from utils.config import *
File renamed without changes.

‎test/sqlconf/conf.py ‎test/configSQL/conf.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
class MysqlLib(object):
99
def __init__(self, ip, user, password, db_name, charset='utf8'):
1010
try:
11-
self.ip = ip
11+
self.ip1 = ip
1212
self.user = user
1313
self.password = password
1414
self.db_name = db_name
1515
self.char = charset
1616

1717
self.MySQL_db = pymysql.connect(
18-
host=self.ip,
18+
host=self.ip1,
1919
user=self.user,
2020
password=self.password,
2121
db=self.db_name,
@@ -148,7 +148,7 @@ def alter_sql(self,which,value):
148148

149149
if __name__ == '__main__':
150150

151-
p = ['localhost','root','password','test']
151+
p = ['127.0.0.1','root','','autotest']
152152
test = MysqlLib(p[0], p[1], p[2], p[3])
153153
print(test)
154154
# print(test.into_sql())
@@ -157,4 +157,4 @@ def alter_sql(self,which,value):
157157
# print(test.query_ont_sql("student",'02'))
158158
# print(test.update_sql('student','hel8o','03'))
159159
# print(test.del_sql('student','03'))
160-
print(test.alter_sql('student','eng_name'))
160+
# print(test.alter_sql('student','eng_name'))
File renamed without changes.

‎test/page/BaiduPage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# @Email : 944921374@qq.com
55

66
from selenium.webdriver.common.by import By
7-
from test.common.Selenium2 import BasePage
7+
from test.common.Seleniums import BasePage
88
import sys
99
sys.path.append('../')
1010
class BaiduPage(BasePage):

‎test/page/elements.yaml

-2
This file was deleted.

‎test/JieKou/token.py ‎test/request/token.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from utils.config import Config
66

77

8-
class get_token:
8+
class get_login_token:
99
c = Config()
1010
username = c.get_case_data('login').get('username')
1111
password = c.get_case_data('login').get('password')
@@ -24,5 +24,5 @@ def login_token(self):
2424
return False
2525

2626
if __name__ == '__main__':
27-
c = get_token()
27+
c = get_login_token()
2828
print(c.login_token())
File renamed without changes.
File renamed without changes.

‎test/case/test_Baidu.py ‎test/testcase/test_Baidu.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import sys
1010
sys.path.append('../')
1111
from test.page.BaiduPage import BaiduPage
12-
from test.case.case_modle import *
12+
from test.testcase.case_modle import *
1313
from test.common.BrowserDriver import BrowserDriver
1414

1515
class BaiduCase(model):

‎utils/config.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,30 @@
44
读取配置。这里配置文件用的yaml,也可用其他如XML,INI等,需在file_reader中添加相应的Reader进行处理。
55
"""
66
import os
7-
from utils.file_read import YamlReader
7+
from utils.readFile import YamlReader
88

99
# 通过当前文件的绝对路径,其父级目录一定是框架的base目录,然后确定各层的绝对路径。如果你的结构不同,可自行修改。
1010
BASE_PATH = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
11-
CONFIG_FILE = os.path.join(BASE_PATH, 'config', 'browser.yaml')
11+
CONFIG_FILE = os.path.join(BASE_PATH, 'data', 'browser.yaml')
12+
# print(CONFIG_FILE)
13+
ELEMENT_PATH = os.path.join(BASE_PATH,'data','elements.yaml')
14+
CASE_PATH = os.path.join(BASE_PATH,'data','testcase.yaml')
15+
INTERFACE_PATH = os.path.join(BASE_PATH,'data','interface.yaml')
1216
DATA_PATH = os.path.join(BASE_PATH, 'data')
1317
DRIVER_PATH = os.path.join(BASE_PATH, 'drivers','chromedriver.exe')
1418
LOG_PATH = os.path.join(BASE_PATH, 'logs')
1519
REPORT_PATH = os.path.join(BASE_PATH, 'report')
1620
SCREENSHOTS_PATH = os.path.join(BASE_PATH,"screenshots",'')
17-
18-
ELEMENT_PATH = os.path.join(BASE_PATH,'test','page','elements.yaml')
19-
CASE_PATH = os.path.join(BASE_PATH,'test','case','case.yaml')
20-
INTERFACE_PATH = os.path.join(BASE_PATH,'test','JieKou','interface.yaml')
2121
EXE_PATH = os.path.join(BASE_PATH,'test','Autolt','test1.jpg')
22-
EXCEL_PATH = os.path.join(BASE_PATH,'test','sqlconf','')
22+
EXCEL_PATH = os.path.join(BASE_PATH,'test','configSQL','')
2323

2424

2525
class Config:
2626
def __init__(self, config=CONFIG_FILE,element = ELEMENT_PATH,case_data = CASE_PATH,
2727
interface_data = INTERFACE_PATH,chrome = DRIVER_PATH,screenshot = SCREENSHOTS_PATH,
2828
excel = EXCEL_PATH):
2929
self.config = YamlReader(config).data
30+
# print(self.config)
3031
self.elements = YamlReader(element).data
3132
self.case_data = YamlReader(case_data).data
3233
self.interface_data = YamlReader(interface_data).data
@@ -67,8 +68,9 @@ def get_excel(self,file_name):
6768

6869
if __name__ == '__main__':
6970
c = Config()
70-
print(c.get("ptahUrl").get('URL'))
71-
print(c.get_ele('URL').get('url'))
72-
print(c.exe_data())
71+
# print(c.get("brwserType"))
72+
# print(c.get_ele('URL').get('url'))
73+
# print(c.exe_data())
7374
# print(c.screen_shot_path())
74-
print(c.get_excel("user"))
75+
# print(c.get_excel("user"))
76+
# print(c.driver_ptah())

‎utils/file_read.py ‎utils/readFile.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ def data(self):
8282

8383

8484
if __name__ == '__main__':
85-
y = 'config.yml'
85+
y = 'browser.yaml'
8686
reader = YamlReader(y)
8787
print(reader.data)
88-
89-
# e = 'E:/Test_framework/data/baidu.xlsx'
90-
# reader = ExcelReader(e, title_line=True)
91-
# print(reader.data)

0 commit comments

Comments
 (0)
Please sign in to comment.