コード例 #1
0
def stop(results_id, force: bool, quit_option=False):
    policy = 'TERMINATE' if force else 'GRACEFUL'
    if tools.confirm(
            "Do you want stop the test" + results_id + " with " +
            policy.lower() + " policy ?", quit_option):
        rest_crud.post(__endpoint + results_id + "/stop",
                       {"stopPolicy": policy})
        return True
    return False
コード例 #2
0
def stop(results_id, force: bool, quit_option=False):
    policy = 'TERMINATE' if force else 'GRACEFUL'
    if tools.confirm(
            "Do you want stop the test" + results_id + " with " +
            policy.lower() + " policy ?", quit_option):
        rest_crud.post(test_results.get_end_point(results_id, "/stop"),
                       {"stopPolicy": policy})
        hooks.trig("test.stop")
        return True
    return False
コード例 #3
0
ファイル: run.py プロジェクト: vijeshv/neoload-cli
def cli(name_or_id, scenario, detached, name, description, as_code, web_vu,
        sap_vu, citrix_vu, return_0):
    """run a test"""
    if not name_or_id or name_or_id == "cur":
        name_or_id = user_data.get_meta(test_settings.meta_key)

    is_id = tools.is_id(name_or_id)
    test_settings_json = tools.get_named_or_id(name_or_id, is_id,
                                               test_settings.__resolver)
    _id = test_settings_json['id']

    if scenario:
        rest_crud.patch('v2/test_result/' + _id, {'scenarioName': scenario})

    naming_pattern = name if name else test_settings_json[
        'testResultNamingPattern']
    if not naming_pattern:
        naming_pattern = "#${runID}"
    naming_pattern = naming_pattern.replace(
        '${runID}', str(test_settings_json['nextRunId']))

    # Sorry for that, post data are in the query string :'( :'(
    post_result = rest_crud.post(
        'v2/tests/%s/start?%s' %
        (_id,
         create_data(naming_pattern, description, as_code, web_vu, sap_vu,
                     citrix_vu)), {})
    user_data.set_meta(test_settings.meta_key, _id)
    user_data.set_meta(test_results.meta_key, post_result['resultId'])
    if not detached:
        running_tools.wait(post_result['resultId'], not return_0)
    else:
        tools.print_json(post_result)
コード例 #4
0
ファイル: run.py プロジェクト: sillekyatha/neoload-cli
def cli(name_or_id, scenario, detached, name, description, as_code, web_vu,
        sap_vu, citrix_vu, return_0):
    """run a test"""
    rest_crud.set_current_command()
    if not name_or_id or name_or_id == "cur":
        name_or_id = user_data.get_meta(test_settings.meta_key)

    is_id = tools.is_id(name_or_id)
    test_settings_json = tools.get_named_or_id(name_or_id, is_id,
                                               test_settings.__resolver)
    _id = test_settings_json['id']

    if scenario:
        rest_crud.patch(test_settings.get_end_point(_id),
                        {'scenarioName': scenario})

    naming_pattern = name if name else test_settings_json[
        'testResultNamingPattern']
    if not naming_pattern:
        naming_pattern = "#${runID}"
    naming_pattern = naming_pattern.replace(
        '${runID}', str(test_settings_json['nextRunId']))

    hooks.trig("test.start", test_settings_json)

    # Sorry for that, post data are in the query string :'( :'(
    post_result = rest_crud.post(
        test_settings.get_end_point(_id) + '/start?' + create_data(
            naming_pattern, description, as_code, web_vu, sap_vu, citrix_vu),
        {})
    user_data.set_meta(test_settings.meta_key, _id)
    user_data.set_meta(test_results.meta_key, post_result['resultId'])
    # Wait 5 seconds until the test result is created.
    time.sleep(5)
    if not detached:
        running_tools.wait(post_result['resultId'], not return_0)
    else:
        tools.print_json(post_result)
コード例 #5
0
ファイル: test_settings.py プロジェクト: vijeshv/neoload-cli
def create(json_data):
    rep = rest_crud.post(__endpoint, fill_default_fields(json_data))
    return tools.get_id_and_print_json(rep)