Exemple #1
0
    def setUpClass(self):
        global ruleType, isRun, caseFrom, caseTo, curl, rulesApi, archiveNum, jar, excel, excelSheet1
        self.Time_PO = TimePO()
        self.File_PO = FilePO()
        self.Excel_PO = ExcelPO()
        self.Device_PO = DevicePO()
        self.List_PO = ListPO()
        self.Color_PO = ColorPO()
        self.excelFile = localReadConfig.get_excel("webFile")
        self.Mysql_PO = MysqlPO(localReadConfig.get_db("host"),
                                localReadConfig.get_db("username"),
                                localReadConfig.get_db("password"),
                                localReadConfig.get_db("database"),
                                localReadConfig.get_db("port"))
        # self.Log_PO = LogPO(logFile, fmt='%(levelname)s - %(message)s - %(asctime)s')  # 输出日志

        self.Web_PO = WebPO("chrome")
        self.Web_PO.openURL(localReadConfig.get_http("webUrl"))
        self.Web_PO.driver.maximize_window()  # 全屏

        self.varExcel = os.path.abspath(
            File_PO.getLayerPath("../config") + "/" + self.excelFile)
        self.varTimeYMDHSM = datetime.datetime.now().strftime(
            '%Y%m%d%H%M%S')  # 获取当天日期时间,格式:20161020130318
        bk = xlrd.open_workbook(self.varExcel, formatting_info=True)
        self.newbk = copy(bk)
        self.sheetMain = bk.sheet_by_name("main")
        self.sheetTestCase = bk.sheet_by_name("testcase")
        self.styleRed = xlwt.easyxf(
            'font: name Times New Roman, color-index red')
        self.styleBlue = xlwt.easyxf(
            'font: name Times New Roman, color-index blue')
        self.styleGray25 = xlwt.easyxf(
            'font: name Times New Roman, color-index gray25')
Exemple #2
0
    def __init__(self):
        global ruleType,isRun,caseFrom,caseTo,curl,rulesApi,archiveNum,jar,excel,excelSheet1
        self.ruleType = localReadConfig.get_filter("ruleType")
        self.isRun = localReadConfig.get_filter("isRun")
        self.caseFrom = localReadConfig.get_filter("caseFrom")
        self.caseTo = localReadConfig.get_filter("caseTo")
        self.caseList = localReadConfig.get_filter("caseList")
        self.curl = localReadConfig.get_http("curl")
        self.rulesApi = localReadConfig.get_http("rulesApi")
        self.archiveNum = localReadConfig.get_http("archiveNum")
        self.jar = localReadConfig.get_jar("jar")
        self.excelFile = localReadConfig.get_excel("excelFile")
        self.excelFileSheetName = localReadConfig.get_excel("excelFileSheetName")

        host = localReadConfig.get_database("host")
        username = localReadConfig.get_database("username")
        password = localReadConfig.get_database("password")
        database = localReadConfig.get_database("database")
        self.Sqlserver_PO = SqlServerPO(host, username, password, database)
        # logFile = localReadConfig.get_log("logFile")
        self.Time_PO = TimePO()
        self.File_PO = FilePO()
        self.Excel_PO = ExcelPO()
Exemple #3
0
# coding=utf-8
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>
# Author     : John
# Created on : 2020-8-14
# Description: SAAS 之 随访管理
# *****************************************************************

from instance.zyjk.SAAS.PageObject.SaasPO import *
Saas_PO = SaasPO()
from PO.TimePO import *
time_PO = TimePO()
from PO.ListPO import *
List_PO = ListPO()
from PO.ColorPO import *
Color_PO = ColorPO()

# 登录
Saas_PO.login("016", "123456")

# # 1,元素库
Saas_PO.clickMenuAll("随访", "元素库")


def validateRule(varRule):
    Saas_PO.Web_PO.clickId("tab-validationRules0", 2)  # 1验证规则
    list1 = Saas_PO.Web_PO.getXpathsText("//span")
    list1 = List_PO.listIntercept(list1, "保存并新增", 1)
    list1 = List_PO.listDel(list1, "")
    # print(list1)
    for i in range(len(varRule)):
        for j in range(len(list1)):
Exemple #4
0
# Description: OA 配置文件
# *****************************************************************

import string, numpy
from string import digits
from PO.HtmlPO import *
from PO.ListPO import *
from PO.TimePO import *
from PO.ColorPO import *
from PO.LogPO import *
from PO.NetPO import *
from PO.DataPO import *
from PO.FilePO import *
from PO.StrPO import *
from PO.ExcelPO import *
from PO.TimePO import *
Time_PO = TimePO()
Color_PO = ColorPO()

from PO.MysqlPO import *
Mysql_PO = MysqlPO("192.168.0.233", "ceshi", "123456", "TD_APP", 3336)  # 测试数据库

# 39 环境
varURL = "http://192.168.0.233"

# 日志文件
logFile = './log/oa_' + Time_PO.getDate() + '.log'



Exemple #5
0
# NULL空值:对应于python中的None,表示这个cell里面没有数据。
# numberic: 数字型,统一按照浮点数来进行处理。对应于python中的float。
# string: 字符串型,对应于python中的unicode。
# 在默认情况下,openpyxl会将整个xlsx都读入到内存中,方便处理。
# 这使得操作大文件的时候,速度较慢,可以使用Optimized reader和Optimized writer。它们提供了流式的接口,速度更快。
# *****************************************************************

import os, time, json
from openpyxl import Workbook
# from openpyxl.compat import range
from openpyxl.utils import get_column_letter
from openpyxl.drawing.image import Image
import openpyxl, os, datetime
from PO.TimePO import *
from PO.ExcelPO import *
Time_PO = TimePO()

from openpyxl.chart import (
    AreaChart,
    Reference,
    Series,
    AreaChart3D,
)

# 实例,新建第3个工作表 Data,遍历10行(从10到20),每行从 C-I 分别填入C-I
# ws3 = wb.create_sheet(title="Data")
# for row in range(10, 20):
#     for col in range(3, 10):
#         _ = ws3.cell(column=col, row=row, value="{0}".format(get_column_letter(col)))

Exemple #6
0
# Description   : SAAS 接口自动化框架
# http://192.168.0.213:8801/doc.html   SAAS接口文档
# http://192.168.0.213/admin/login web页 18622222222,123456
# *****************************************************************

import os, sys, json, jsonpath, unittest, platform, time
from datetime import datetime
from time import sleep
from parameterized import parameterized
from BeautifulReport import BeautifulReport as bf
import instance.zyjk.SAAS.PageObject.ReadConfigPO as readConfig
localReadConfig = readConfig.ReadConfigPO()
from instance.zyjk.SAAS.PageObject.XlsPO import *
Xls_PO = XlsPO()
from PO.TimePO import *
Time_PO = TimePO()
from PO.DataPO import *
data_PO = DataPO()
from PO.ColorPO import *
Color_PO = ColorPO()
from PO.MysqlPO import *
Mysql_PO = MysqlPO("192.168.0.195", "root", "Zy123456", "saasuserdev",
                   3306)  # 测试环境
l_interIsRun = (Xls_PO.getInterIsRun())  # 获取inter中isRun执行筛选列表 ,[[], [], 3]


class testInterface(unittest.TestCase):
    @parameterized.expand(Xls_PO.getCaseParam())
    def test(self, excelNo, caseName, method, interName, param, jsonpathKey,
             expected, generation, selectSQL, updateSQL):
Exemple #7
0
# coding=utf-8
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# Author     : John
# Created on : 2020-6-3
# Description: 统计禅道中测试人员上一工作日的任务。
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

import sys, platform, os
sys.path.append("../../../")
from time import sleep
from PO.TimePO import *
Time_PO = TimePO()
from PO.FilePO import *
File_PO = FilePO()
from PO.MysqlPO import *
Mysql_PO = MysqlPO("192.168.0.211", "readonly", "benetech123", "zentaoep",
                   3306)

from PO.OpenpyxlPO import *
excelName = "禅道每日审查_测试.xlsx"
excelSheet = "每日禅道审查"
Openpyxl_PO = OpenpyxlPO(excelName)
Openpyxl_PO.closeExcelPid('EXCEL.EXE')  # 关闭所有打开的excel

# 获取当天的工作日
l_rowcol = Openpyxl_PO.l_getTotalRowCol(excelSheet)
for i in range(11):
    varStartDate = str(Time_PO.get_day_of_day(-i))
    # varStartDate = str(Time_PO.get_day_of_day(-1-i)) # 上一工作日
    if cal.is_working_day(
            date(int(varStartDate.split("-")[0]),
Exemple #8
0
# -*- coding: utf-8 -*-
# *********************************************************************
# Author        : John
# Date          : 2020-4-26
# Description   : Logging 日志模块
# python中logging日志模块详解, https://www.cnblogs.com/xianyulouie/p/11041777.html
# *********************************************************************

import logging
from logging import handlers
from PO.TimePO import *
Time_PO = TimePO()


class LogPO(object):
    level_relations = {
        'debug': logging.DEBUG,
        'info': logging.INFO,
        'warning': logging.WARNING,
        'error': logging.ERROR,
        'crit': logging.CRITICAL
    }  #日志级别关系映射

    def __init__(
        self,
        filename,
        level='debug',
        when='D',
        backCount=3,
        fmt='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s'
    ):
Exemple #9
0
# coding: utf-8
# *****************************************************************
# Author     : John
# Date       : 2020-5-12
# Description: 电子健康档案 - 质控配置文件
# *****************************************************************

from PO.LogPO import *
from PO.NetPO import *
from PO.DataPO import *
from PO.ExcelPO.ExcelPO import *
from PO.TimePO import *
Time_PO = TimePO()

from PO.SqlserverPO import *
Sqlserver_PO = SqlServerPO("192.168.0.35", "test", "123456",
                           "healthcontrol_test")  # 测试环境

# 日志文件
logFile = './log/controlRul_' + Time_PO.getDate() + '.log'

# # 邮件信息
# email_nickNameByFrom = u'令狐冲'
# email_sender = '*****@*****.**'
# email_receiver = "*****@*****.**"
# email_subject = "bi自动化测试结果"
# email_content = "你好!\n\n\n    这是本次bi集成平台自动化测试结果,请查看附件。\n\n\n\n\n\n\n\n这是一封自动产生的email,请勿回复 \n测试组 \nBest Regards"
# email_attachment = logFile
Exemple #10
0
# for mac,将 HTMLTestRunner.py 拷贝到 /usr/local/lib/python3.7/site-packages
# for win,将 HTMLTestRunner.py 拷贝到 C:\Python27\Lib\site-packages
# HtmlTestRunner_PO = HtmlTestRunnerPO("./", "test*.py", "." + "/h4" + "/", "result_" + Time_PO.getDatetime() + ".html","功能测试报告 - Func123", "副标题用例执行详细信息")
# 参数1,./  表示当前目录
# 参数2,test*.py 表示执行所有test开头的脚本
# 参数3,"." + "/h4" + "/", 表示将结果html保存在当前h4目录中,如果h4不存在则自动创建此目录
# 参数4,"result_" + Time_PO.getDatetime() + ".html" ,表示文件名
# 参数5,"功能测试报告 - Func123" 表示html报告中大标题
# 参数6,副标题用例执行详细信息 表示html报告中副标题
# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

import unittest
from HTMLTestRunner import HTMLTestRunner
from PO.TimePO import *
from PO.FilePO import *
Time_PO = TimePO()
File_PO = FilePO()


class HtmlTestRunnerPO():
    def __init__(self, varFolder, varPattern, varReportFolder, varReport,
                 varTitle, varDesc):
        # 类的构造函数
        self.varFolder = varFolder
        self.varPattern = varPattern
        self.varReportFolder = varReportFolder
        self.varReport = varReport
        self.varTitle = varTitle
        self.varDesc = varDesc
        File_PO.newFolder(os.getcwd() + "/" + varReportFolder)