zoukankan      html  css  js  c++  java
  • robotframework

    一、用户关键字操作思路

    a、创建model1资源

    b、在model下创建用户关键字 - 循环

    c、测试套件下创建test_case/case2 & 用户关键字

    d、测试套件中导入Resource 的 model1 资源

    二、对应的操作如下:

    1、右键单击创建资源 -- 自定义输入name -- 小编的为 model1

    2、在model上右键单击创建 user key  -- 小编定义的关键字为 add & myrange

    3、 用户关键字 add 运算,使用到 Evaluate 关键字

    4、用户关键字 myrange 范围

     

    5、新建测试套件-User key--- 在User key 下创建Test case &  User Keyword

    6、在 User key 测试套件中导入model 资源

    7、test_case & cese2 实例截图:

    8、test_case & case2 脚本如下:

    *** Settings ***
    Resource model.robot

    *** Test Cases ***
    test_case
    myrange 5
    ${c} add 5 3
    log ${c}

    test_case2
    [Setup] start
    log this is test case
    [Teardown] end

    *** Keywords ***
    start
    log start test case

    end
    log end test case

    9、test_case & case2 用例执行结果:

    Starting test: Rf Test Pro.User Key.test_case
    20190622 23:17:33.670 : INFO : 0
    20190622 23:17:33.672 : INFO : 1
    20190622 23:17:33.674 : INFO : 2
    20190622 23:17:33.676 : INFO : 3
    20190622 23:17:33.677 : INFO : 4
    20190622 23:17:33.680 : INFO : ${c} = 8
    20190622 23:17:33.681 : INFO : ${c} = 8
    20190622 23:17:33.682 : INFO : 8
    Ending test: Rf Test Pro.User Key.test_case

    Starting test: Rf Test Pro.User Key.test_case2
    20190622 23:17:33.685 : INFO : start test case
    20190622 23:17:33.687 : INFO : this is test case
    20190622 23:17:33.689 : INFO : end test case
    Ending test: Rf Test Pro.User Key.test_case2

  • 相关阅读:
    LintCode A+B问题
    LintCode 斐波纳契数列
    LintCode 删除链表中的元素
    LintCode 整数排序
    c++ lower_bound upper_bound
    259. 3Sum Smaller
    86. Partition List
    209. Minimum Size Subarray Sum
    11. Container With Most Water
    360. Sort Transformed Array
  • 原文地址:https://www.cnblogs.com/Teachertao/p/11070885.html
Copyright © 2011-2022 走看看