• 大小: 4.14MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-18
  • 语言: Python
  • 标签: Selenium  

资源简介

Selenium POM自动化测试框架, 测试员只需专注于自动化测试用例的开发,框架自动收集测试结果并生成测试报告。

资源截图

代码片段和文件信息

# coding=utf-8
import sys
sys.path.append(“\testsuites“)
sys.path.append(“\tools“)
from testsuites import *
import unittest
import time
import StringIO
import HTMLTestRunner
import logging

#------------------------------------------------------------
caselists=‘testsuites\\‘
def createsuite():
    testunit=unittest.TestSuite()
    discover=unittest.defaultTestLoader.discover(caselists
                pattern =‘test*.py‘
                top_level_dir=None)
    for test_suite in discover:
        for test_case in test_suite:
            testunit.addTests(test_case)
            print testunit
    return testunit
#----------------------------------------------------------
#get cases list
alltestnames = createsuite()
#Add log to log file
logging.basicConfig(level=logging.DEBUG
            format=‘%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s‘
            datefmt=‘%a %d %b %Y %H:%M:%S‘
            filename=‘logs\myapp.log‘
            filemode=‘w‘)
logging.debug(‘success read case list!!‘)
logging.info(‘success read case list!!‘)
#prepare to gernate a report
now = time.strftime(“%Y-%m-%d-%H-%M-%S“time.localtime())
filename = ‘testreport\\‘+now+‘result.html‘
fp = file(filename ‘wb‘)
runner =HTMLTestRunner.HTMLTestRunner(
        stream=fp
        title=‘Automation Test Report‘
        description=‘Executed status‘)
#--------------------------------------------------------------------------------
logging.info(‘Begin to run test suites!!‘)
try:
    if alltestnames is not None:
        runner.run(alltestnames)
    else:
        logging.info(‘Test case list is empty!!‘)
except RuntimeError:
    logging.info(‘Fail to run all test cases!!‘)
logging.info(‘Begin to send mail!!‘)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-08-14 11:57  PythonApplication8\
     目录           0  2017-08-14 11:57  PythonApplication8\PythonApplication8\
     文件         780  2017-08-07 17:08  PythonApplication8\PythonApplication8.sln
     文件      161792  2017-08-09 13:39  PythonApplication8\PythonApplication8.v11.suo
     目录           0  2017-08-14 11:57  PythonApplication8\PythonApplication8\config\
     文件          78  2017-08-08 17:15  PythonApplication8\PythonApplication8\config\config.ini
     目录           0  2017-08-14 11:57  PythonApplication8\PythonApplication8\framework\
     文件        5207  2017-08-08 17:22  PythonApplication8\PythonApplication8\framework\base_page.py
     文件        7070  2017-08-08 17:23  PythonApplication8\PythonApplication8\framework\base_page.pyc
     文件        1785  2017-08-08 17:20  PythonApplication8\PythonApplication8\framework\browser_engine.py
     文件        2418  2017-08-08 17:21  PythonApplication8\PythonApplication8\framework\browser_engine.pyc
     文件        1176  2017-08-08 17:21  PythonApplication8\PythonApplication8\framework\logger.py
     文件        1649  2017-08-08 17:21  PythonApplication8\PythonApplication8\framework\logger.pyc
     文件           0  2015-07-17 14:25  PythonApplication8\PythonApplication8\framework\__init__.py
     文件         201  2017-08-08 13:24  PythonApplication8\PythonApplication8\framework\__init__.pyc
     目录           0  2017-08-14 11:57  PythonApplication8\PythonApplication8\logs\
     文件        1114  2017-08-08 16:17  PythonApplication8\PythonApplication8\logs\201708081615.log
     文件         184  2017-08-08 17:10  PythonApplication8\PythonApplication8\logs\201708081710.log
     文件         184  2017-08-08 17:12  PythonApplication8\PythonApplication8\logs\201708081712.log
     文件         184  2017-08-08 17:13  PythonApplication8\PythonApplication8\logs\201708081713.log
     文件         857  2017-08-08 17:14  PythonApplication8\PythonApplication8\logs\201708081714.log
     文件        2184  2017-08-08 17:16  PythonApplication8\PythonApplication8\logs\201708081715.log
     文件        2184  2017-08-08 17:19  PythonApplication8\PythonApplication8\logs\201708081718.log
     文件         495  2017-08-08 17:21  PythonApplication8\PythonApplication8\logs\201708081721.log
     文件        2184  2017-08-08 17:23  PythonApplication8\PythonApplication8\logs\201708081723.log
     文件       12966  2017-08-08 17:23  PythonApplication8\PythonApplication8\logs\myapp.log
     文件        1782  2017-08-08 16:19  PythonApplication8\PythonApplication8\MainTest.py
     目录           0  2017-08-14 11:57  PythonApplication8\PythonApplication8\pageobjects\
     文件         465  2017-08-08 10:48  PythonApplication8\PythonApplication8\pageobjects\baidu_homepage.py
     文件        1516  2017-08-08 13:38  PythonApplication8\PythonApplication8\pageobjects\baidu_homepage.pyc
     文件         249  2017-08-08 10:52  PythonApplication8\PythonApplication8\pageobjects\baidu_news_home.py
............此处省略35个文件信息

评论

共有 条评论