robotframework案例

本文涉及的产品
公网NAT网关,每月750个小时 15CU
简介: robotframework案例

一、公共方法

common.robot

*** Settings ***
Library           Selenium2Library
*** Keywords ***
wait element
    [Arguments]    ${LOCATOR}
    sleep    2
    Wait Until Element Is Visible    ${LOCATOR}
    Wait Until Element Is Enabled    ${LOCATOR}
    Wait Until Page Contains Element    ${LOCATOR}
    SLEEP    2
wait input element
    [Arguments]    ${LOCATOR}    ${INPUT_TEXT}
    wait element    ${LOCATOR}
    Input Text    ${LOCATOR}    ${INPUT_TEXT}
wait click element
    [Arguments]    ${LOCATOR}
    wait element    ${LOCATOR}
    Click Element    ${LOCATOR}
Login_Beijing
    wait input element    css=#userNameId input    gwx613100
    wait input element    css=#pwdId input    Bigdata_2013
    wait click element    css=#loginForm #buttonArea:nth-child(1) #btn_submit
    Wait Until Page Contains    Quick Start Guide
    Sleep    2
Login_retry
    Open Browser    https://console.huaweicloud.com/vpc/?region=cn-north-1&locale=en-us#/vpc/vpcmanager/dashboard    chrome
    Maximize Browser Window
    Set Window Size    1920    1080
    ${winsize}    Get Window Size
    log    ${winsize}
    Wait Until Keyword Succeeds    3x    3s    Login_Beijing
enter dashboard
    sleep    1
    go to    https://console.huaweicloud.com/vpc/?region=cn-north-1&locale=en-us#/vpc/vpcmanager/dashboard
    Wait Until Page Contains    Quick Start Guide
    sleep    2
close new select old
    Close Window
    Select Window

二、测试套-测试用例

Dashborad-All.robot

*** Settings ***
Suite Setup       Login_retry
Suite Teardown    Close Browser
Library           Selenium2Library
Resource          common.txt
Resource          VPC_Resource_Dashbord.txt
*** Test Cases ***
Dashborad-To-VPC
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPC
Dashborad-To-SecurityGroup
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-SecurityGroup
Dashborad-To-Network ACLs
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Network ACLs
Dashborad-To-Eips
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Eips
Dashborad-To-ShareBandwidth
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-ShareBandwidth
Dashborad-To-NAT Gateways
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-NAT Gateways
Dashborad-To-Elastic Load Balance
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Elastic Load Balance
Dashborad-To-Peering Connections
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Peering Connections
Dashborad-To-VPC Endpoints
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPC Endpoints
Dashborad-To-VPN Gateways
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPN Gateways
Dashborad-To-Direct Connections
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Direct Connections
Dashborad-To-Cloud Connection
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-Cloud Connection
Dashborad-To-VPN Connections
    [Tags]    hec
    Wait Until Keyword Succeeds    3x    3s    Dashborad-To-VPN Connections

三、资源文件

VPC_Resource_Dashbord.robot

*** Settings ***
Library           Selenium2Library
Resource          common.txt
*** Keywords ***
Dashborad-To-VPC
    enter dashboard
    wait click element    css=#_vpc
    wait click element    jquery=button:contains(Create VPC)
    wait input element    css=input[ng-model="$ctrl.vpcNameBox.value"]    vpc-temp01
    Wait Until Page Contains    Basic Information
Dashborad-To-SecurityGroup
    enter dashboard
    wait click element    css=#_securityGroup
    wait click element    jquery=button span:contains(Create Security Group)
    Wait Until Page Contains    Description
Dashborad-To-Network ACLs
    enter dashboard
    wait click element    css=#_firewall
    wait click element    jquery=button span:contains(Create Network ACL)
    Wait Until Page Contains    Description
Dashborad-To-Eips
    enter dashboard
    wait click element    css=#_eip
    wait click element    jquery=button span:contains(Buy EIP)
    Wait Until Page Contains    Billing Mode
Dashborad-To-ShareBandwidth
    enter dashboard
    wait click element    css=#_shareBandwidth
    wait click element    jquery=button span:contains(Buy Shared Bandwidth)
    Wait Until Page Contains    Billing Mode
Dashborad-To-NAT Gateways
    enter dashboard
    wait click element    css=#_nat
    wait click element    jquery=button span:contains(Buy NAT Gateway)
    Wait Until Page Contains    Billing Mode
Dashborad-To-Elastic Load Balance
    enter dashboard
    wait click element    css=#_elb
    wait click element    jquery=button span:contains(Buy Enhanced Load Balancer)
    Wait Until Page Contains    Network Type
Dashborad-To-Peering Connections
    enter dashboard
    wait click element    css=#_peering
    wait click element    jquery=button span:contains(Create VPC Peering Connection)
    Wait Until Page Contains    Local VPC Settings
Dashborad-To-VPC Endpoints
    enter dashboard
    wait click element    css=#_vpcep
    Wait Until Page Contains    Apply for VPC Endpoint OBT
    wait click element    jquery=button:contains(Apply Now)
    Select Window    new
    Wait Until Page Contains    Apply for Open Beta Test
    close new select old
Dashborad-To-VPN Gateways
    enter dashboard
    wait click element    css=#vpngwAll >span
    wait click element    jquery=span:contains(Buy VPN Gateway)
    Wait Until Page Contains    Billing Mode
Dashborad-To-Direct Connections
    enter dashboard
    wait click element    css=#dc_physicalDlines >span
    Wait Until Page Contains    To connect your network to HUAWEI CLOUD, you must first create a connection
    wait click element    css=a[ng-href="#/dc/createPhyDlinePartner"]
    Wait Until Page Contains    Your Equipment Room Address
Dashborad-To-Cloud Connection
    enter dashboard
    wait click element    css=#cloudConnect_cnsAll >span
    wait click element    css=#createCCBtn > span.cti-btn-label.ng-binding.ng-scope
    Wait Until Page Contains    Description
Dashborad-To-VPN Connections
    enter dashboard
    wait click element    css=#vpngwAll >span
    wait click element    jquery=span:contains(Buy VPN Gateway)
    Wait Until Page Contains    Billing Mode

测试用例

Test_Vpcs.robot

*** Settings ***
Suite Setup       Login_retry
Suite Teardown    Close Browser
Library           Selenium2Library
Resource          common.txt
*** Test Cases ***
Create_vpc
    [Tags]    hec
    wait click element    css=#_vpc
    wait click element    jquery=button:contains(Create VPC)
    wait input element    css=input[ng-model="$ctrl.vpcNameBox.value"]    vpc-temp01
    Wait Until Page Contains    Basic Information
*** Keywords ***
相关文章
|
3月前
|
数据可视化 测试技术 持续交付
自动化测试神器:Python之Pytest库入门使用
自动化测试神器:Python之Pytest库入门使用
97 4
|
7月前
|
JSON Java 测试技术
Python + Appium 自动化操作微信入门
Python + Appium 自动化操作微信入门
137 0
|
3月前
|
JavaScript Java 开发工具
Python+Appium2.0的APP自动化环境搭建
Python+Appium2.0的APP自动化环境搭建
110 0
|
9月前
|
数据可视化 机器人 测试技术
自动化测试 RobotFramework安装以及使用教程
自动化测试 RobotFramework安装以及使用教程
|
存储 JSON 测试技术
接口测试|HttpRunner简介及安装
接口测试|HttpRunner简介及安装
191 0
接口测试|HttpRunner简介及安装
|
IDE 测试技术 开发工具
《手把手教你》系列基础篇之1-python+ selenium自动化测试-环境搭建(详细)
《手把手教你》系列基础篇之1-python+ selenium自动化测试-环境搭建(详细)
164 0
《手把手教你》系列基础篇之1-python+ selenium自动化测试-环境搭建(详细)
|
机器人 程序员 测试技术
RobotFramework环境搭建
RobotFramework环境搭建
RobotFramework环境搭建
|
机器人 测试技术 Python
Robotframework的基本知识
Robotframework的基本知识
Robotframework的基本知识
|
机器人 jenkins 测试技术
RobotFramework基础篇-环境搭建
Robotframework(通常简称RF,在下文中都将用RF代替)是一个关键字驱动的自动化测试框架,底层是基于Python语言实现的。
RobotFramework基础篇-环境搭建
|
存储 jenkins 机器人
RobotFramework实战篇-PC端web自动化demo及持续集成
Robotframework该框架的学习成本比较低,很多功能都是现成的,而且脚本易于维护,而且同时支持web端,移动端以及接口自动化,用例套件管理以及用例执行和报告查看,日志记录等功能都比较完善,而且可扩展性强。
RobotFramework实战篇-PC端web自动化demo及持续集成