自动化测试 RF+Jenkins+git

  •   RF 公共文件resource.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
*** Settings ***
Library           SeleniumLibrary
Library    String
 
*** Variables ***
${host}           http://192.168.10.185:18090
${loginUrl}     /#/login
${username-admin}         alam
${password-admin}       666666
${pwdXpath}       //input[@type='password']
${usernameXpath}       //div[@id='app']/div/div/form/input
${captchaXpath}       //div[@id='app']/div/div/form/div[2]/input
${loginBtnXpath}       //button[@type='button']
${menu_auth}        //ul[@id='menu']/li[5]/div
${menu_setting}      //ul[@id='menu']/li[6]/div
#${table_path}           //*[@id="app"]/div/div[3]/div/div[2]/div/div[1]/div[2]/table
${table_path}            //*/text()[normalize-space(.)='序号']/parent::*
 
*** Keywords ***
login
    [Arguments]    ${username}    ${password}
    ${newUrl}=      Catenate    SEPARATOR=      ${host}    ${loginUrl}
    Open Browser    ${newUrl}    Chrome
    Set Browser Implicit Wait    10
    Maximize Browser Window
    Input Text    xpath=${usernameXpath}    ${username}
    Input Text    xpath=${pwdXpath}         ${password}
    Input Text    xpath=${captchaXpath}         ikas
    Click Element    xpath=${loginBtnXpath}
    Sleep    2
 
login-admin
    login       ${username-admin}       ${password-admin}
 
 
click
    [Arguments]    ${element}
    Sleep    1
    Click Element  ${element}
 
type
    [Arguments]    ${element}    ${value}
    Sleep    1
    Input Text     ${element}    ${value}
 
open
    [Arguments]    ${element}
    Sleep    1
    Go To          ${element}
 
Table1RowShouldContain
    [Arguments]    ${table_path}        ${name}
    Sleep    1
    Table Row Should Contain    xpath=${table_path}    1    ${name}

  

  • RF 登录
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
*** Settings ***
Resource          resource.txt
Test Teardown     close browser
 
*** Test Cases ***
login
    [Template]      login-Validation
    alam          666666      系统首页
    alam111       666666      用户不存在
    alam          888888      密码错误
 
*** Keywords ***
login-Validation
    [Arguments]    ${username}    ${password}       ${keywords}
    login       ${username}       ${password}
    Page Should Contain     ${keywords}
    close browser
  •    业务case
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
*** Settings ***
Resource          resource.txt
Test Setup        login-admin
Test Teardown     close browser
 
 
*** Variables ***
${menu_side_bar}           //div[@id='app']/div/div/div[2]/img
${menu_home}                 //div[@id='app']/div/div[2]/div/div/ul/li
${menu_scheduling}            //div[@id='app']/div/div[2]/div/div/ul/li[4]/div
${menu_schedulingInput}                   //div[@id='app']/div/div[2]/div/div/ul/li[4]/ul/li
${schedulingInput_url_path}           /scheduling/schedulingInput
@{rows}        计划编码  计划版本号  排程计划生成时间  配置参数数量  模型状态
*** Keywords ***
 
 
*** Test Cases ***
APS排程输入 - 进入
    # login-admin
    Page Should Contain     IKAS-智能生产排程系统
    click    xpath=${menu_side_bar}
    click    xpath=${menu_home}
    click    xpath=${menu_scheduling}
    click    xpath=${menu_schedulingInput}
    FOR    ${row_name}    IN    @{rows}
        Page Should Contain     ${row_name}
        # Table1RowShouldContain    ${table_path}    ${row_name}
    END
    Location Should Contain     ${schedulingInput_url_path}
    ${schedulingInput_url}    Log Location
    log     ${schedulingInput_url}
    Set Suite Variable    ${schedulingInput_url}

  然后放在git管理平台

Jenkins配置

 

  •  执行如图

 

  •  最后一个邮件

 

posted @   AlamZ  阅读(134)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示