How to use locustio - 10 common examples

To help you get started, we’ve selected a few locustio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atlassian / dc-app-performance-toolkit / app / locustio / jira / requests_params.py View on Github external
def jira_datasets():
    data_sets = dict()
    data_sets["issues"] = read_input_file(JIRA_DATASET_ISSUES)
    data_sets["users"] = read_input_file(JIRA_DATASET_USERS)
    data_sets["jqls"] = read_input_file(JIRA_DATASET_JQLS)
    data_sets["scrum_boards"] = read_input_file(JIRA_DATASET_SCRUM_BOARDS)
    data_sets["kanban_boards"] = read_input_file(JIRA_DATASET_KANBAN_BOARDS)
    data_sets["projects"] = read_input_file(JIRA_DATASET_PROJECTS)
    page_size = 25
    projects_count = len(data_sets['projects'])
    data_sets['pages'] = projects_count // page_size if projects_count % page_size == 0 \
        else projects_count // page_size + 1
    return data_sets
github atlassian / dc-app-performance-toolkit / app / locustio / jira / requests_params.py View on Github external
def jira_datasets():
    data_sets = dict()
    data_sets["issues"] = read_input_file(JIRA_DATASET_ISSUES)
    data_sets["users"] = read_input_file(JIRA_DATASET_USERS)
    data_sets["jqls"] = read_input_file(JIRA_DATASET_JQLS)
    data_sets["scrum_boards"] = read_input_file(JIRA_DATASET_SCRUM_BOARDS)
    data_sets["kanban_boards"] = read_input_file(JIRA_DATASET_KANBAN_BOARDS)
    data_sets["projects"] = read_input_file(JIRA_DATASET_PROJECTS)
    page_size = 25
    projects_count = len(data_sets['projects'])
    data_sets['pages'] = projects_count // page_size if projects_count % page_size == 0 \
        else projects_count // page_size + 1
    return data_sets
github atlassian / dc-app-performance-toolkit / app / locustio / jira / requests_params.py View on Github external
def jira_datasets():
    data_sets = dict()
    data_sets["issues"] = read_input_file(JIRA_DATASET_ISSUES)
    data_sets["users"] = read_input_file(JIRA_DATASET_USERS)
    data_sets["jqls"] = read_input_file(JIRA_DATASET_JQLS)
    data_sets["scrum_boards"] = read_input_file(JIRA_DATASET_SCRUM_BOARDS)
    data_sets["kanban_boards"] = read_input_file(JIRA_DATASET_KANBAN_BOARDS)
    data_sets["projects"] = read_input_file(JIRA_DATASET_PROJECTS)
    page_size = 25
    projects_count = len(data_sets['projects'])
    data_sets['pages'] = projects_count // page_size if projects_count % page_size == 0 \
        else projects_count // page_size + 1
    return data_sets
github atlassian / dc-app-performance-toolkit / app / locustio / jira / requests_params.py View on Github external
def jira_datasets():
    data_sets = dict()
    data_sets["issues"] = read_input_file(JIRA_DATASET_ISSUES)
    data_sets["users"] = read_input_file(JIRA_DATASET_USERS)
    data_sets["jqls"] = read_input_file(JIRA_DATASET_JQLS)
    data_sets["scrum_boards"] = read_input_file(JIRA_DATASET_SCRUM_BOARDS)
    data_sets["kanban_boards"] = read_input_file(JIRA_DATASET_KANBAN_BOARDS)
    data_sets["projects"] = read_input_file(JIRA_DATASET_PROJECTS)
    page_size = 25
    projects_count = len(data_sets['projects'])
    data_sets['pages'] = projects_count // page_size if projects_count % page_size == 0 \
        else projects_count // page_size + 1
    return data_sets
github atlassian / dc-app-performance-toolkit / app / locustio / jira / requests_params.py View on Github external
def jira_datasets():
    data_sets = dict()
    data_sets["issues"] = read_input_file(JIRA_DATASET_ISSUES)
    data_sets["users"] = read_input_file(JIRA_DATASET_USERS)
    data_sets["jqls"] = read_input_file(JIRA_DATASET_JQLS)
    data_sets["scrum_boards"] = read_input_file(JIRA_DATASET_SCRUM_BOARDS)
    data_sets["kanban_boards"] = read_input_file(JIRA_DATASET_KANBAN_BOARDS)
    data_sets["projects"] = read_input_file(JIRA_DATASET_PROJECTS)
    page_size = 25
    projects_count = len(data_sets['projects'])
    data_sets['pages'] = projects_count // page_size if projects_count % page_size == 0 \
        else projects_count // page_size + 1
    return data_sets
github atlassian / dc-app-performance-toolkit / app / locustio / jira / requests_params.py View on Github external
def jira_datasets():
    data_sets = dict()
    data_sets["issues"] = read_input_file(JIRA_DATASET_ISSUES)
    data_sets["users"] = read_input_file(JIRA_DATASET_USERS)
    data_sets["jqls"] = read_input_file(JIRA_DATASET_JQLS)
    data_sets["scrum_boards"] = read_input_file(JIRA_DATASET_SCRUM_BOARDS)
    data_sets["kanban_boards"] = read_input_file(JIRA_DATASET_KANBAN_BOARDS)
    data_sets["projects"] = read_input_file(JIRA_DATASET_PROJECTS)
    page_size = 25
    projects_count = len(data_sets['projects'])
    data_sets['pages'] = projects_count // page_size if projects_count % page_size == 0 \
        else projects_count // page_size + 1
    return data_sets
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
def view_board(locust, board_id, view_backlog=False):
    params = ViewBoard()
    if view_backlog:
        url = f'/secure/RapidBoard.jspa?rapidView={board_id}&view=planning'
    else:
        url = f'/secure/RapidBoard.jspa?rapidView={board_id}'

    r = locust.client.get(url, catch_response=True)
    content = r.content.decode('utf-8')
    project_key = fetch_by_re(params.project_key_pattern, content)
    project_id = fetch_by_re(params.project_id_pattern, content)
    project_plan = fetch_by_re(params.project_plan_pattern, content, group_no=2)
    if project_plan:
        project_plan = project_plan.replace('\\', '')
    logger.locust_info(f"{params.action_name}: key = {project_key}, id = {project_id}, plan = {project_plan}")
    assert f'currentViewConfig\"{{\"id\":{board_id}', 'Could not open board'

    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1000"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1005"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1010"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1015"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1020"),
                       TEXT_HEADERS, catch_response=True)
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
def create_issue_open_quick_create():
        r = locust.client.post('/secure/QuickCreateIssue!default.jspa?decorator=none',
                               ADMIN_HEADERS, catch_response=True)
        content = r.content.decode('utf-8')
        atl_token = fetch_by_re(params.atl_token_pattern, content)
        form_token = fetch_by_re(params.form_token_pattern, content)
        issue_type = fetch_by_re(params.issue_type_pattern, content)
        resolution_done = fetch_by_re(params.resolution_done_pattern, content)
        fields_to_retain = re.findall(params.fields_to_retain_pattern, content)
        custom_fields_to_retain = re.findall(params.custom_fields_to_retain_pattern, content)

        issue_body_params_dict = {'atl_token': atl_token,
                                  'form_token': form_token,
                                  'issue_type': issue_type,
                                  'project_id': project_id,
                                  'resolution_done': resolution_done,
                                  'fields_to_retain': fields_to_retain,
                                  'custom_fields_to_retain': custom_fields_to_retain
                                  }
        if not ('"id":"project","label":"Project"' in content):
            logger.error(f'{params.err_message_create_issue}: {content}')
        assert '"id":"project","label":"Project"' in content, params.err_message_create_issue
        locust.client.post('/rest/quickedit/1.0/userpreferences/create', params.user_preferences_payload,
github atlassian / dc-app-performance-toolkit / app / locustio / confluence / http_actions.py View on Github external
def create_blog_editor():
        r = locust.client.get(f'/pages/createblogpost.action?spaceKey={blog_space_key}', catch_response=True)
        content = r.content.decode('utf-8')
        if 'Blog post title' not in content:
            logger.error(f'Could not open editor for {blog_space_key}: {content}')
        assert 'Blog post title' in content, 'Could not open editor for blog.'

        atl_token = fetch_by_re(params.atl_token_re, content)
        content_id = fetch_by_re(params.content_id_re, content)
        parsed_space_key = fetch_by_re(params.space_key, content)

        locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("910"),
                           TEXT_HEADERS, catch_response=True)
        locust.client.get('/rest/mywork/latest/status/notification/count?pageId=0', catch_response=True)
        locust.client.get('/plugins/servlet/notifications-miniview', catch_response=True)
        locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("925"),
                           TEXT_HEADERS, catch_response=True)
        locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("930"),
                           TEXT_HEADERS, catch_response=True)
        locust.client.get(f'/rest/emoticons/1.0/_={timestamp_int()}', catch_response=True)
        locust.client.get(f'/rest/shortcuts/latest/shortcuts/{build_number}/{keyboard_hash}?_={timestamp_int()}',
                          catch_response=True)

        heartbeat_activity_body = {"dataType": "json",
                                   "contentId": content_id,
github atlassian / dc-app-performance-toolkit / app / locustio / jira / http_actions.py View on Github external
def view_board(locust, board_id, view_backlog=False):
    params = ViewBoard()
    if view_backlog:
        url = f'/secure/RapidBoard.jspa?rapidView={board_id}&view=planning'
    else:
        url = f'/secure/RapidBoard.jspa?rapidView={board_id}'

    r = locust.client.get(url, catch_response=True)
    content = r.content.decode('utf-8')
    project_key = fetch_by_re(params.project_key_pattern, content)
    project_id = fetch_by_re(params.project_id_pattern, content)
    project_plan = fetch_by_re(params.project_plan_pattern, content, group_no=2)
    if project_plan:
        project_plan = project_plan.replace('\\', '')
    logger.locust_info(f"{params.action_name}: key = {project_key}, id = {project_id}, plan = {project_plan}")
    assert f'currentViewConfig\"{{\"id\":{board_id}', 'Could not open board'

    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1000"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1005"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1010"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1015"),
                       TEXT_HEADERS, catch_response=True)
    locust.client.post('/rest/webResources/1.0/resources', params.resources_body.get("1020"),
                       TEXT_HEADERS, catch_response=True)