Example #1
0
def init_system_env(request):
    """
    自定义初始化系统环境变量
    :param request:
    :return:
    """
    from common.tools import Tools
    # 读取命令行入参,写入系统本地环境变量
    run_env = request.config.getoption(
        'environment') if request.config.getoption('environment') else 'dev'
    Tools.set_env("TEST_ENV", run_env)
Example #2
0
def on_test_start(**kwargs):
    global params, queueData
    params = Tools().get_csv_info('recordTop1000.csv')
    queueData = queue.Queue()

    # 参数放入队列
    for param in params:
        param = {"customerId": param[0]}
        queueData.put_nowait(param)
    def __init__(self, page: Page):
        self.page = page

        self.host = Tools.get_config("base_url")
        self.path = "/"
        self.url = self.host + self.path
        self.search_input = "#kw"  # 搜索框
        self.search_button = "#su"  # 搜索按钮
        self.settings = "#s-usersetting-top"  # 设置
        self.search_setting = "#s-user-setting-menu > div > a.setpref"  # 搜索设置
        self.save_setting = 'text="保存设置"'  # 保存设置
def on_test_start(**kwargs):
    global params, queueData
    params = Tools().get_csv_info('getCompletedMediaCount.csv')
    queueData = queue.Queue()

    # 参数放入队列
    for param in params:
        param = {
            "customerId": param[0],
            "categoryIds": param[1]
        }
        queueData.put_nowait(param)
def on_test_start(**kwargs):
    global params, queueData
    params = Tools().get_csv_info('customergoods_split.csv')
    queueData = queue.Queue()

    # 参数放入队列
    for param in params:
        param = {
            "customerId": param[0],
            "gd1": param[1],
            "gd2": param[2],
            "gd3": param[3],
            "gd4": param[4],
            "gd5": param[5]
        }
        queueData.put_nowait(param)
Example #6
0
# -*- coding: utf-8 -*-

import requests
import json
import time
from urllib.parse import quote, urlencode
from common.tools import Tools
from locust import HttpUser, task, between
from urllib3.exceptions import InsecureRequestWarning
requests.urllib3.disable_warnings(InsecureRequestWarning)  # 禁用安全警告
t = Tools()


class BatchCreate(HttpUser):

    wait_time = between(0.1, 0.2)

    @task(1)
    def batchCreate(self):

        # query参数
        apiparam = {"method": "zhiyong.study.question.question.batchCreate"}

        # body参数
        body = {
            "questions": [{
                "categoryId":
                -1,
                "type":
                "0",
                "title":
Example #7
0
def on_test_start(**kwargs):
    global count, params
    # 计数器,作为csv文件的行号
    count = 0
    params = Tools().get_csv_info('jjxt_user_info.csv')
Example #8
0
 def fixtures(self):
     yield Tools.get_fixtures("baidu_search")
Example #9
0
 def to_representation(self, value):
     # 将Goods模型返回的add_time转换为时间戳
     # 重写它以支持序列化,用于读取操作。
     ts = Tools.datetime2timestamp(value)
     return ts