コード例 #1
0
def get_data():
    arr = list()
    data = ReadJson.read_json("app_article.json")
    for a in data.values():
        arr.append((a.get("channel"), a.get("title")))
    print(arr)
    return arr
コード例 #2
0
class Test_glq(unittest.TestCase):
    data = ReadJson.read_json('../test_element/element.json')["txljq"]
    driver = MyWebDriver.start()

    @classmethod
    def setUpClass(cls):
        Login.login()
        MyWebDriver.wait_element_present(cls.data["page"]).click()
        MyWebDriver.wait_element_present(cls.data["exploitpeople"]).click()
        MyWebDriver.wait_element_present(cls.data["txljq"]).click()

    def setUp(self):
        MyWebDriver.wait_element_present(self.data["page"]).click()

    @parameterized.expand([('describe', '2')])
    def test_1_add_ljq(self, describe, text):
        MyWebDriver.wait_element_present(self.data["addljq"]).click()
        MyWebDriver.wait_element_present(self.data["tcp"]).click()
        UpperTools.input(self.data["describe"], describe)
        MyWebDriver.wait_element_present(self.data["select"]).click()
        MyWebDriver.wait_element_present(
            '/html/body/div[3]/div[2]/div/div/div[2]/form/div[2]/div[1]/div/div/div[2]/ul[2]/li[%s]'
            % text).click()
        self.assertEqual(1, 1)

    def tearDown(self):
        pass

    @classmethod
    def tearDownClass(cls):
        MyWebDriver.start().close()
コード例 #3
0
class Login:

    driver = MyWebDriver.start()
    data = ReadJson.read_json('../test_element/element.json')

    @classmethod
    def login(cls):
        data = cls.data['login']
        UpperTools.input(data['username'], 'test004')
        UpperTools.input(data['password'], 'qw123456')
        MyWebDriver.wait_element_present(data['button']).click()
コード例 #4
0
class Test_LuYou(unittest.TestCase):
    data = ReadJson.read_json('../test_element/element.json')["luyou"]
    driver = MyWebDriver.start()

    @classmethod
    def setUpClass(cls):
        Login.login()

    def setUp(self):
        MyWebDriver.wait_element_present(self.data["page"]).click()

    # @parameterized.expand()
    def test_1_add_luyou(self):
        MyWebDriver.wait_element_present(self.data["page"]).click()
        self.assertEqual(1, 1)

    def tearDown(self):
        pass

    @classmethod
    def tearDownClass(cls):
        pass
コード例 #5
0
def get_data():
    arr = list()
    data = ReadJson.read_json("app_login.json")
    for a in data.values():
        arr.append((a.get("username"), a.get("password")))
    return arr
コード例 #6
0
def get_data():
    data = ReadJson.read_json('mp_article.json')
    arr = []
    for a in data.values():
        arr.append((a.get('title'), a.get('channel')))
    return arr
コード例 #7
0
def get_data():
    data = ReadJson.read_json('mis_login.json')
    arr = []
    for a in data.values():
        arr.append((a.get('username'), a.get('password')))
    return arr
コード例 #8
0
ファイル: test_runner.py プロジェクト: songyifan0803/zjk_bank
#Author:
#CreatDate:
#Version:
#====#====#====#====

import unittest
from HTMLTestRunner_cn import HTMLTestRunner  # 用例执行器
import time
from tools.read_json import ReadJson


if __name__ == '__main__':
    ts = unittest.TestSuite()
    loader = unittest.TestLoader()
    # 通过设置执行设置文档获取相应的用例
    config = ReadJson.read_json("test_load_gui.conf")
    tests = loader.loadTestsFromNames(config["testLoadList"])
    # 形成测试套件
    ts.addTests(tests)
    unittest.TextTestRunner().run(ts)
    # 用时间戳来命名报告文件,避免文件名重复
    # now = time.strftime("%Y-%m-%d_%H%M%S")
    # filename = "../test_report/" + now + ".html"
    # # 以字节写入模式打开一个文件,用来接收执行结果
    # with open(filename, 'wb') as fp:
    # # 执行器配置
    #     runner = HTMLTestRunner(
    #         stream=fp,
    #         verbosity=2,
    #         title='张家口bank 测试报告',
    #         description="测试模块:路由",