Exemplo n.º 1
0
from selenium import webdriver
import time
from country_list import exceldata
import ddt
import unittest
from BeautifulReport import BeautifulReport
from public import basepage

#提取前面脚本注册成功后的数据
e = exceldata()
rows = e.openexcel(r'E:\test\account_number.xlsx',
                   'Sheet1')  #测试文档的路径,sheet名,并获取总行数
testdata = e.dict_data()


@ddt.ddt
class review(unittest.TestCase, basepage):
    """bos初审通过"""
    def setUp(self):
        self.dr = webdriver.Chrome()
        #实例化父类
        self.pub = basepage(self.dr)
        self.dr.get('https://at-bos-frontend-uat.atfxdev.com/login')
        time.sleep(1)

    def tearDown(self):
        self.dr.close()
        self.dr.quit()

    @ddt.data(*testdata)
    def test_review(self, data):
Exemplo n.º 2
0
from country_list import exceldata
from openpyxl import load_workbook
import random

countrydata = exceldata()
countrydata.openexcel(r'E:\test\all_country.xlsx', 'Sheet1')
countrytest = countrydata.dict_data()


class creat_datatest():
    """国家,三字码,邮箱自动写入测试文档,无需手动注册"""

    #创建存储注册数据的函数,写入已存在的本地文档中
    def saveaccount(self, excelpath, val, col, row):
        """注:调用此函数时,不能打开需要写入数据的文档"""
        workbook = load_workbook(filename=excelpath)
        sheet = workbook.active
        cel = sheet['{}{}'.format(col, row)]
        cel.value = val
        workbook.save(filename=excelpath)

    #创建是否需要执行此类的函数
    def iscreat(self):
        self.n = input('输入数字表示需要几条测试用例,非数字表示不需要制造测试数据')
        try:
            int(self.n)
            return self.n, True
        except:
            return False

    #生成n位数的随机数(联通号码开头)