├── .idea
├── Daemon_.iml
├── misc.xml
├── modules.xml
└── vcs.xml
├── README.md
├── config
├── __init__.py
├── config.yml
└── db_config.ini
├── data
├── __init__.py
└── baidu.xlsx
├── db
├── __init__.py
└── mongo_db.py
├── drivers
├── IEDriverServer.exe
├── chromedriver.exe
└── phantomjs.exe
├── emaill
└── mail.py
├── geckodriver.log
├── htmltestrunner
├── HTMLTestRunner.py
├── HTMLTestRunner_in.py
└── __init__.py
├── report
├── 2018-04-13 11_27_17_result.html
├── 2018-04-13 11_33_34_result.html
├── 2018-04-13 11_34_55_result.html
├── 2018-04-13 13_06_08_result.html
└── screenpicture
│ ├── 20180413112728.png
│ ├── 20180413113348.png
│ ├── 20180413113506.png
│ └── 20180413130657.png
├── run.py
├── src
├── __init__.py
├── test
│ ├── __init__.py
│ ├── case
│ │ ├── __init__.py
│ │ ├── geckodriver.log
│ │ ├── test_ad_position.py
│ │ ├── test_baidu.py
│ │ └── test_login.py
│ ├── common
│ │ ├── __init__.py
│ │ └── base_page.py
│ └── suit
│ │ ├── __init__.py
│ │ ├── aquapaasADV
│ │ ├── __init__.py
│ │ ├── ad_position_page.py
│ │ └── login_page.py
│ │ ├── baidu
│ │ ├── __init__.py
│ │ └── search_page.py
│ │ └── docker_interface
│ │ └── __init__.py
└── utils
│ ├── __init__.py
│ ├── browser.py
│ ├── config.py
│ ├── file_reader.py
│ ├── geckodriver.log
│ └── log.py
└── test.py
/.idea/Daemon_.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Daemon_AutoFramework
2 | web自动化测试框架
3 |
--------------------------------------------------------------------------------
/config/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # @Time : 2018/4/11 10:32
4 | # @Author : huanghe
5 | # @Site :
6 | # @File : __init__.py.py
7 | # @Software: PyCharm
--------------------------------------------------------------------------------
/config/config.yml:
--------------------------------------------------------------------------------
1 | URL: http://10.50.4.115:8080/paasadv/
2 | USER: root
3 | PASSWORD: 123
4 | BaiDuURl: https://www.baidu.com/
5 | log:
6 | file_name: test.log
7 | backup: 5INFO
8 | console_level: DEBUG
9 | file_level: DEBUG
10 | pattern: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
11 |
12 | mongodb:
13 | host: 39.106.144.46
14 | port: 27017
15 | user:
16 | password:
--------------------------------------------------------------------------------
/config/db_config.ini:
--------------------------------------------------------------------------------
1 | [mongoconf]
2 | host=39.106.144.46
3 | port=27017
4 | user=
5 | password=
--------------------------------------------------------------------------------
/data/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # @Time : 2018/4/11 10:33
4 | # @Author : huanghe
5 | # @Site :
6 | # @File : __init__.py.py
7 | # @Software: PyCharm
--------------------------------------------------------------------------------
/data/baidu.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smarthaut/Daemon_AutoFramework/49dd148173b294ff33079c7ac284ae00723b82ed/data/baidu.xlsx
--------------------------------------------------------------------------------
/db/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # @Time : 2018/4/13 13:09
4 | # @Author : huanghe
5 | # @Site :
6 | # @File : __init__.py.py
7 | # @Software: PyCharm
--------------------------------------------------------------------------------
/db/mongo_db.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # @Time : 2018/4/13 13:11
4 | # @Author : huanghe
5 | # @Site :
6 | # @File : mongo_db.py
7 | # @Software: PyCharm
8 | import pymongo
9 | from src.utils.config import Config
10 |
11 | class DB:
12 | def __init__(self):
13 | cf = Config().get('mongodb')
14 | self.host = cf.get('host')
15 | self.port = cf.get('port')
16 | self.user = cf.get('user')
17 | self.password = cf.get('password')
18 | try:
19 | self.client = pymongo.MongoClient(self.host, port=int(self.port))
20 | except:
21 | print('数据库连接失败')
22 |
23 | def getConnection(self, table_name, connection_name):
24 | db = self.client.get_database(table_name)
25 | svod = db.get_collection(connection_name)
26 | return svod
27 |
28 |
29 | if __name__ =='__main__':
30 | db =DB()
31 | print(db.host)
--------------------------------------------------------------------------------
/drivers/IEDriverServer.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smarthaut/Daemon_AutoFramework/49dd148173b294ff33079c7ac284ae00723b82ed/drivers/IEDriverServer.exe
--------------------------------------------------------------------------------
/drivers/chromedriver.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smarthaut/Daemon_AutoFramework/49dd148173b294ff33079c7ac284ae00723b82ed/drivers/chromedriver.exe
--------------------------------------------------------------------------------
/drivers/phantomjs.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smarthaut/Daemon_AutoFramework/49dd148173b294ff33079c7ac284ae00723b82ed/drivers/phantomjs.exe
--------------------------------------------------------------------------------
/emaill/mail.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # @Time : 2018/4/16 10:03
4 | # @Author : huanghe
5 | # @Site :
6 | # @File : mail.py
7 | # @Software: PyCharm
8 | import smtplib
9 | from email.mime.text import MIMEText
10 | from email import encoders
11 | from email.header import Header
12 | from email.mime.multipart import MIMEMultipart
13 | from email.mime.base import MIMEBase
14 | from email.utils import parseaddr,formataddr
15 |
16 |
17 |
18 | class Email:
19 | def __init__(self,server,sender,password,receiver,subject,title=None,message=None,path=None):
20 | self.server = server
21 | self.sender = sender
22 | self.password = password
23 | self.receiver = receiver
24 | self.subject = subject
25 | self.msg = MIMEMultipart()
26 | #self.msg = MIMEText(msg,'plain','utf-8')
27 |
28 | def _format_addr(self,s):
29 | name,addr = parseaddr(s)
30 | return formataddr((Header(name,'utf-8').encode(),addr))
31 |
32 | def send(self):
33 | server = smtplib.SMTP(self.server,25)
34 | server.set_debuglevel(1)
35 | server.login(self.sender,self.password)
36 | server.sendmail(self.sender,[self.receiver],self.msg.as_string())
37 | server.quit()
38 |
39 | def add_fujian(self,filepath):
40 | with open(filepath,'rb')as f:
41 | mime = MIMEBase('image','png',filename='test.png')
42 | mime.add_header('Content-Disposition', 'attachment',filename='test.png')
43 | mime.add_header('Content-ID', '<0>')
44 | mime.add_header('X-Attachment-Id', '0')
45 | mime.set_payload(f.read())
46 | encoders.encode_base64(mime)
47 | self.msg.attach(mime)
48 |
49 | def set_content(self,msg):
50 | self.msg['From'] = self._format_addr('发件人<{}>'.format(self.sender))
51 | self.msg['To'] = self._format_addr('收件人<{}>'.format(self.receiver))
52 | self.msg['Subject'] = Header(self.subject, 'utf-8').encode()
53 | self.msg.attach(MIMEText(msg,'plain','utf-8'))
54 |
55 |
56 | if __name__ == '__main__':
57 | msg = 'helllo'
58 | email = Email(server='mail.xor-media.tv',sender='he.huang@xor-media.tv',password='2953653ABCDE'
59 | ,receiver='943298665@qq.com',subject='主题')
60 | email.set_content(msg)
61 | email.add_fujian('test.png')
62 | #name,addr = parseaddr('Python爱好者')
63 | #print(formataddr((Header(name,'utf-8').encode(),addr)))
64 | email.send()
--------------------------------------------------------------------------------
/htmltestrunner/HTMLTestRunner.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | # @Time : 2017/12/28 11:43
4 | # @Author : huanghe
5 | # @Site :
6 | # @File : HTMLTestRunner.py
7 | # @Software: PyCharm
8 | #coding=utf-8
9 | """
10 | A TestRunner for use with the Python unit testing framework. It
11 | generates a HTML report to show the result at a glance.
12 |
13 | The simplest way to use this is to invoke its main method. E.g.
14 |
15 | import unittest
16 | import HTMLTestRunner
17 |
18 | ... define your tests ...
19 |
20 | if __name__ == '__main__':
21 | HTMLTestRunner.main()
22 |
23 |
24 | For more customization options, instantiates a HTMLTestRunner object.
25 | HTMLTestRunner is a counterpart to unittest's TextTestRunner. E.g.
26 |
27 | # output to a file
28 | fp = file('my_report.html', 'wb')
29 | runner = HTMLTestRunner.HTMLTestRunner(
30 | stream=fp,
31 | title='My unit test',
32 | description='This demonstrates the report output by HTMLTestRunner.'
33 | )
34 |
35 | # Use an external stylesheet.
36 | # See the Template_mixin class for more customizable options
37 | runner.STYLESHEET_TMPL = ''
38 |
39 | # run the test
40 | runner.run(my_test_suite)
41 |
42 |
43 | ------------------------------------------------------------------------
44 | Copyright (c) 2004-2007, Wai Yip Tung
45 | All rights reserved.
46 |
47 | Redistribution and use in source and binary forms, with or without
48 | modification, are permitted provided that the following conditions are
49 | met:
50 |
51 | * Redistributions of source code must retain the above copyright notice,
52 | this list of conditions and the following disclaimer.
53 | * Redistributions in binary form must reproduce the above copyright
54 | notice, this list of conditions and the following disclaimer in the
55 | documentation and/or other materials provided with the distribution.
56 | * Neither the name Wai Yip Tung nor the names of its contributors may be
57 | used to endorse or promote products derived from this software without
58 | specific prior written permission.
59 |
60 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
61 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
62 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
63 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
64 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
65 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
66 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
67 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
68 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
69 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
70 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
71 | """
72 |
73 | # URL: http://tungwaiyip.info/software/HTMLTestRunner.html
74 |
75 | __author__ = "Wai Yip Tung, Findyou"
76 | __version__ = "0.8.2.2"
77 |
78 |
79 | """
80 | Change History
81 | Version 0.8.2.2-huanghe
82 | *添加截图展示功能
83 |
84 | Version 0.8.2.1 -Findyou
85 | * 改为支持python3
86 |
87 | Version 0.8.2.1 -Findyou
88 | * 支持中文,汉化
89 | * 调整样式,美化(需要连入网络,使用的百度的Bootstrap.js)
90 | * 增加 通过分类显示、测试人员、通过率的展示
91 | * 优化“详细”与“收起”状态的变换
92 | * 增加返回顶部的锚点
93 |
94 | Version 0.8.2
95 | * Show output inline instead of popup window (Viorel Lupu).
96 |
97 | Version in 0.8.1
98 | * Validated XHTML (Wolfgang Borgert).
99 | * Added description of test classes and test cases.
100 |
101 | Version in 0.8.0
102 | * Define Template_mixin class for customization.
103 | * Workaround a IE 6 bug that it does not treat
213 |
214 | %(stylesheet)s
215 |
216 |
217 |
302 | %(heading)s
303 | %(report)s
304 | %(ending)s
305 |
306 |
307 |