zoukankan      html  css  js  c++  java
  • Robot Framework接口自动化案例分享④——L2接口层

    一、L2接口层.robot

    1.G1-GET请求

    *** Settings ***
    Resource          ../../L3Public.robot
    
    *** Variables ***
    
    *** Keywords ***
    获取所有地理围栏
        [Arguments]    ${path}    ${test_data}    ${code}
        ${params}    json.loads    ${test_data}
        ${info}    Get_method    ${path}    ${params}
        Assert    ${info.json()['code']}    ${code}
        [Return]    ${info}
    
    获取测试数据G1
        ${test_data}    Get Xlsx    G1
        Set Suite Variable    ${test_data}

    2.G2-POST请求

    *** Settings ***
    Resource          ../../L3Public.robot
    
    *** Variables ***
    
    *** Keywords ***
    新增地理围栏
        [Arguments]    ${path}    ${test_data}    ${name}    ${code}
        ${dict}    json.loads    ${test_data}
        ${data}    update_value1    ${dict}    name    ${name}
        ${info}    Post_method    ${path}    ${data}
        Assert    ${info.json()['code']}    ${code}
        [Return]    ${info}
    
    获取测试数据G2
        ${test_data}    Get Xlsx    G2
        Set Suite Variable    ${test_data}

    3.G3-PUT请求

    *** Settings ***
    Resource          ../../L3Public.robot
    
    *** Variables ***
    
    *** Keywords ***
    更新地理围栏
        [Arguments]    ${path}    ${test_data}    ${name}    ${code}
        ${data1}    json.loads    ${test_data}
        ${data}    update_value1    ${data1}    name    ${name}
        ${info}    Put_method    ${path}    ${data}
        Assert    ${info.json()['code']}    ${code}
        [Return]    ${info}
    
    获取测试数据G3
        ${test_data}    Get Xlsx    G3
        Set Suite Variable    ${test_data}

    4.G4-DELETE请求

    *** Settings ***
    Resource          ../../L3Public.robot
    Resource          ../G2.新增地理围栏/L2接口层.robot
    Resource          ../G1.获取所有地理围栏/L2接口层.robot
    
    *** Variables ***
    
    *** Keywords ***
    返回新增地理围栏id
        ${test_data}    Get Xlsx    G2
        ${name}    Randomstr    4    25
        ${dict}    json.loads    ${test_data[0]['data']}
        ${data}    update_value1    ${dict}    name    ${name}
        ${info}    Post_method    ${test_data[0]['path']}    ${data}
        ${test_data1}    Get Xlsx    G1
        ${params}    json.loads    ${test_data1[0]['params']}
        ${info}    Get_method    ${test_data1[0]['path']}    ${params}
        ${id}    Get Value    ${info.json()["data"]['list']}    name    ${name}    id
        [Return]    ${id}
    
    删除地理围栏
        [Arguments]    ${path}    ${code}
        ${info}    Delete_method    ${path}    ${air}
        Assert    ${info.json()['code']}    ${code}
        [Return]    ${info}
    
    获取测试数据G4
        ${test_data}    Get Xlsx    G4
        Set Suite Variable    ${test_data}
     
    —————————————————————————————— 选择正确的事、再把事做正确 ——————————————————————————————
  • 相关阅读:
    Visual Studio工具 vcpkg简介
    可跨平台C++开源图形图像框架:openFrameworks
    Visual Studio2017 设置了vcpkg之后,编译其他程序出问题
    PCL 3维点云的模板匹配
    Eigen库和STL容器冲突问题
    C 和 CPP 混合代码cmath编译出错
    VS2017在Release下编译错误C1001
    伪随机数
    和求余运算巧妙结合的jns指令
    [显示属性]-自定义桌面里没有IE选项
  • 原文地址:https://www.cnblogs.com/airb/p/13181945.html
Copyright © 2011-2022 走看看