コード例 #1
0
ファイル: send_mail.py プロジェクト: fengyu0712/myclone
 def __init__(self):
     conf = Read_conf(conf_path)
     self.senter = conf.get_value("Email", "senter")
     self.passwords = conf.get_value("Email", "passwords")
     self.mail_host = conf.get_value("Email", "mail_host")
     self.mail_post = conf.get_value("Email", "mail_post")
     self.receiver = conf.get_value("Email", "receiver")
     self.senter_name = conf.get_value("Email", "senter_name")
     self.receiver_name = conf.get_value("Email", "receiver_name")
コード例 #2
0
ファイル: businessProcess.py プロジェクト: fengyu0712/myclone
from Common.regular import regular
from Page_Object.Android.LoginPage import Login
from Page_Object.Android.Public import Main
from Page_Object.Android.HomePage import Home
from Page_Object.Android import QuestionPage
from Page_Object.Android import ResultPage
from Page_Object.Android.QuestionPage import Question
from Page_Object.Android.AnswerCardPage import AnswerCard
from Page_Object.Android.ResultPage import Result
from Page_Object.Android import MinePage
from Page_Object.Android.MinePage import Mine
import time, sys

appium_path = Project_path.Conf_path + "appium.conf"
mode_path = Project_path.Conf_path + "app_TestMode.conf"
desired_caps = Read_conf(appium_path).get_value("Android", "desired_caps")
appium_url = Read_conf(appium_path).get_value("Android", "appium_url")
mode = Read_conf(mode_path).get_value("Mode", "mode")

#元素定位
mine_username_location = MinePage.mine_username_location
see_answer = QuestionPage.see_answer_location
result_pagetitle = ResultPage.page_title_location

userconf_path = Project_path.Conf_path + "bkt_user.conf"
account = Read_conf(userconf_path).get_value("Test", "account")
password = Read_conf(userconf_path).get_value("Test", "password")


class TestBProcess(unittest.TestCase):
    @classmethod
コード例 #3
0
from Common.read_xls import Read_xls
from Common.write_xls import WriteExcel
from Common.http_request import Request
from Common.list_dict import Change
from Common.conf import Read_conf
from Conf import Project_path
from Common.mysql import MySql
from Common.log import Logger
from Common import globalvar as gl
import time,unittest,allure,pytest,sys
from ddt import ddt,data

test_data_path= Project_path.TestData_path + "Test_data1.xls"
mode_path=Project_path.Conf_path+"interf_TestMode.conf"
http_conf_path=Project_path.Conf_path+"http.conf"
host=Read_conf(http_conf_path).get_value("HTTP","host")
mode=Read_conf(mode_path).get_value("Mode","login_mode")
conf_path=Project_path.Conf_path+"db.conf"
config=Read_conf(conf_path).get_value("Mysql","config")
sql=MySql(config)
datas= Read_xls().read_data(test_data_path,booknum=0) #默认读取第一个表格
keys_list = datas[0]
test_data=[]
if mode == 1:
    Logger().info("[mode:1],本次测试执行基本流测试用例")
    for i in range(len(datas)):
        if datas[i][2] == 1:
            test_data.append(datas[i])
            i += 1
        else:
            continue
コード例 #4
0
import pytest
import allure
import yaml
from selenium import webdriver
from Common.conf import Read_conf
from Common.log import Logger
from Conf import Project_path
conf_path = Project_path.Conf_path + "Web.conf"
env_conf = Project_path.Conf_path + "env_config.yml"

url = Read_conf(conf_path).get_value("BID", "url")


@pytest.fixture(scope="session", autouse=True)
# def env(request):
#     """
#     Parse env config info
#     """
#     root_dir = request.config.rootdir
#     # config_path = 'E:\python_space\Conf\env_config.yml'.format(root_dir)
#     # with open(config_path,encoding='utf-8') as f:
#     #     env_config = yaml.load(f) # 读取配置文件
#     allure.environment(host='123') # 测试报告中展示host
#     allure.environment(browser='456') # 测试报告中展示browser
#
#     return env_config

@pytest.fixture(scope='class')
def Web_driver_class():
    driver = webdriver.Firefox()
    Logger().info("测试开始了!")
コード例 #5
0
from Page_Object.Web.testpage import home_page
from Page_Object.Web.testpage import login_page
from Page_Object.Web.testpage.login_page import Login
from Page_Object.Web.testpage.home_page import Home
import sys, time

from Common.conf import Read_conf
from Common.log import Logger
from Common import PC_cmd
from Conf import Project_path
import pytest, allure

conf_path = Project_path.Conf_path + "Web.conf"
url = Read_conf(conf_path).get_value("BID", "url")
login_account = Read_conf(conf_path).get_value("BID", "login_account")
pickname = Read_conf(conf_path).get_value("BID", "my_account_name")
password = Read_conf(conf_path).get_value("BID", "password")

# verificationErrors=[]
myaccount_location = home_page.myaccount_location
error_noaccount_location = login_page.error_noaccount_location
error_nopassword_location = login_page.error_nopassword_location
error_wrongpassword_location = login_page.error_wrongpassword_location
error_wrongaccount_location = login_page.error_wrongaccount_location
error_wrongphone_location = login_page.error_wrongaccount_location
homelogin_location = home_page.homelogin_location


@pytest.mark.usefixtures("Web_driver_class", "Web_driver")
@allure.feature('登录功能接口')
class Test_Login():
コード例 #6
0
import unittest, allure
from appium import webdriver
from Conf import Project_path
from Common.conf import Read_conf
from Common.log import Logger
from Page_Object.Android.LoginPage import Login
from Page_Object.Android.Public import Main
from Page_Object.Android import QuestionPage
from Page_Object.Android import MinePage
from Page_Object.Android.MinePage import Mine
import time, sys

appium_path = Project_path.Conf_path + "appium.conf"
mode_path = Project_path.Conf_path + "app_TestMode.conf"
desired_caps = Read_conf(appium_path).get_value("Android", "desired_caps")
appium_url = Read_conf(appium_path).get_value("Android", "appium_url")
mode = Read_conf(mode_path).get_value("Mode", "mode")

#元素定位
mine_username_location = MinePage.mine_username_location
see_answer = QuestionPage.see_answer_location


@allure.feature("APP登录功能测试")
class LoginTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        Log = Logger()
        Log.info("========%s测试开始:========" % __class__.__name__)
        nowtime = time.strftime("%Y%m%d%H%M")
        driver = webdriver.Remote(appium_url, desired_caps)
コード例 #7
0
create_data_sql= "create table test_data("\
                  "id int not null PRIMARY key auto_increment," \
                  "url varchar(50) ," \
                  "mobilephone varchar(15)," \
                  "amount int(12)," \
                  "type varchar(12)," \
                  "test_result varchar(100) ," \
                  "create_date datetime," \
                  "update_date datetime" \
                  ")DEFAULT CHARSET=utf8"

getdata_sql = "select url from test.test_data where id=1"

# insert_sql='insert into test_data (created_day,name,count) values(%s,%s,%s)'
insert_sql = 'INSERT INTO `test`.`test_data`(`id`, `url`, `mobilephone`, `amount`, `type`, `test_result`, `create_date`, `update_date`) VALUES (%s, NULL, NULL, NULL, NULL, NULL, NULL, NULL)'
conf_path = Project_path.Conf_path + "db.conf"
config = Read_conf(conf_path).get_value("Mysql", "config")

if __name__ == '__main__':
    a = MySql(config)
    a.creat_table(create_data_sql)
    a.insert_manydata(insert_sql, data=[2, 3])
    b = a.read_data(getdata_sql)
    print(b)
    # pd.DataFrame(result)
    # print(eval(b[0][0]))
    # print(type(eval(b))
    # a.close()
    # print(b)
    # print(type(b[1][3]))
コード例 #8
0
ファイル: w_mysql.py プロジェクト: fengyu0712/myclone
from Common.read_xls_news import Read_xls
from Common.mysql import MySql
from Common.conf import Read_conf

yidian = "E:/python_space/1test/yidian.xls"

r_xls = Read_xls(yidian)
data = r_xls.read_data()
print(data)
yidian_db = "E:/python_space/1test/yidian.conf"
config = Read_conf(yidian_db).get_value("YiDian", "config")

sql1 = "INSERT INTO bp_event_copy VALUES(%s,%s,%s,'2018-05-23 13:51:56',%s,%s)"
sql2 = "Select * from bp_event"
MySql(config).insert_manydata(sql1, data)
a = MySql(config).read_data(sql2)
print(a[-1])

# for each in data:
#     sql="INSERT INTO bp_event VALUES(%s,%s,%s,'2018-05-23 13:51:56',%s,%s)"
#     MySql(config).insert_data(sql,tuple(each))
コード例 #9
0
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.dirname(os.path.dirname(os.path.dirname(curPath)))
sys.path.append(rootPath)  # 获取绝对路径,以便shell脚本跑
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium import webdriver
import time, platform, json
from selenium.webdriver import DesiredCapabilities

from Common.conf import Read_conf
from Conf import Project_path
from Common.log import Logger

conf_path = Project_path.Conf_path + "web.ini"
url = Read_conf(conf_path).get_value("AI", "url")
login_account = Read_conf(conf_path).get_value("AI", "login_account")
password = Read_conf(conf_path).get_value("AI", "password")

account_location = "//input[@name='username']"
password_location = "//input[@name='password']"
login_button_location = "//span[text()='登录']/.."

login_labeling = "//h1[text()='标注任务']"
continue_ys = "//button[@class='el-button el-button--primary el-button--small button']"
start_ys = "//span[text()='开始验收']/.."
YES = "//span[text()='确定']"

# 加载启动项

chrome_options = webdriver.ChromeOptions()
コード例 #10
0
from AITEST.Common.read_xls_news import Read_xls
from AITEST.Common.write_xls import WriteExcel
from AITEST.Common.T_websocket import WsSingle
from Common.conf import Read_conf
from Common.log import Logger
from Conf import Project_path
import sys,time,unittest,pytest,allure
from ddt import ddt,data


conf_path=Project_path.Conf_file_path
url=Read_conf(conf_path+"/ws.conf").get_value("WS","url")
print(url)
audio_path=Read_conf(conf_path+"/ws.conf").get_value("WS","audio_path")
test_data_path=Project_path.TestData_path+"/case.xlsx"
r=Read_xls(test_data_path)
w=r.copy_book()

sheet_names=r.get_sheet_names()
print(sheet_names)
# writedata = WriteExcel()
testdatas = r.read_data("002M30_36", start_line=3)
print(testdatas)
コード例 #11
0
ファイル: accountlogin.py プロジェクト: fengyu0712/myclone
from selenium.webdriver.support import expected_conditions as EC
from  selenium.webdriver.common.by import By
from appium import webdriver
from Conf import Project_path
from Common.conf import Read_conf
from Common.log import Logger
from Page_Object.Android.LoginPage import Login
from Page_Object.Android import LoginPage
from Page_Object.Android import Public
from Page_Object.Android import MinePage
from  Page_Object.Android.AccountSetPage import Accoune_set
from Page_Object.Android import AccountSetPage
import time,sys

appium_path=Project_path.Conf_path+"appium.conf"
desired_caps=Read_conf(appium_path).get_value("Android","desired_caps")
appium_url=Read_conf(appium_path).get_value("Android","appium_url")

#元素定位
mine_location=Public.mine_location
mine_login_location=MinePage.mine_login_location
mine_username_location=MinePage.mine_username_location
account='13017659465'
password='******'

class AccountLoginTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        nowtime = time.strftime("%Y%m%d%H%M")
        Log = Logger()
        driver = webdriver.Remote(appium_url, desired_caps)
コード例 #12
0
ファイル: Public.py プロジェクト: fengyu0712/myclone
from Common.conf import Read_conf

mainmenu_location = "com.jeagine.cloudinstitute:id/tab_img_%s"
back_button_location = "com.jeagine.cloudinstitute:id/zhuce1_back"
quit_login_button_location = "com.jeagine.cloudinstitute:id/rl_memberinfo_logout"
Yes_location = "com.jeagine.cloudinstitute:id/confirm_btn"
close_advertising_location = "com.jeagine.cloudinstitute:id/ib_close"
close_update_location = "com.jeagine.cloudinstitute:id/btn_close"
share_location = "com.jeagine.cloudinstitute:id/iv_share"
share_menu_location = "com.jeagine.cloudinstitute:id/share_popuwindow"
cancel_share_location = "com.jeagine.cloudinstitute:id/btn_cencel"
confirm_window = "com.jeagine.cloudinstitute:id/layout"  #原毙考题弹窗
yidian_confirm_window = "com.jeagine.cloudinstitute:id/tvTitle"

userconf_path = Project_path.Conf_path + "bkt_user.conf"
account = Read_conf(userconf_path).get_value("Test", "account")
password = Read_conf(userconf_path).get_value("Test", "password")


class Main:
    def __init__(self, driver):
        self.driver = driver

    def into_Mainpage(self, type):  #type=  1:首页  2:学习 3:考友圈 4:我的.............
        try:
            WebDriverWait(self.driver, 10, 0.2).until(
                EC.visibility_of_element_located(
                    (By.ID, mainmenu_location % type)))
        except Exception as e:
            raise e
        else: