如何在Robot Framework中配置cumulusci?

问题描述 投票:-1回答:2

我正在组织中进行概念验证,使用机器人框架以及seleniumlibrary和cumulusci来自动化我们基于salesforce的平台。这是我到目前为止设置的内容:

  1. 我在我的.robot项目文件中添加了cumulusci资源,例如:在Suite Setup级别导入资源$ {CURDIR} /cumulusci/robotframework/Salesforce.robot
  2. 我还将我的.robot项目文件放在这个位置:$ {CURDIR} /cumulusci/tests/MyProjectFile.robot
  3. 我的$ {CURDIR}以及cumulusci位置在windows系统PATH变量中。

注意:此时,我能够在纯粹基于seleniumlibrary的Ui上识别和单击元素,但是我还需要能够利用cci功能。

当我尝试使用时:

*** Test Cases ***
TestSample
Salesforce.Click Object Button  <mybuttonstitle>

我得到:找不到名为'Salesforce.Click模态按钮'的关键字。

我的推荐:https://cumulusci.readthedocs.io/en/latest/robotframework.html https://cumulusci.readthedocs.io/en/latest/_downloads/Keywords.html

寻找有关cci设置,访问关键字或任何其他方面的帮助,你们觉得我在cci-rfw前面缺少了。

谢谢。

salesforce robotframework
2个回答
1
投票

我相信,你错过了Salesforce库的导入,

*** Settings ***
Resource        cumulusci/robotframework/Salesforce.robot

另外,请确保已经安装了Python包。


0
投票

感谢你的帮助Bryan和KJ。实际问题是我创建的文件夹结构不正确。当我对其进行排序时,我的cumulusci关键字开始工作。这就是我所说的:https://groups.google.com/forum/#!topic/robotframework-users/iaeUZU_htk4

CommonEnvironment.robot

*** Keywords ***

Call all python libraries and resources
    import library  SeleniumLibrary  timeout=20
    import library  OperatingSystem
    import resource  C:/Python37/Lib/site-packages/cumulusci/robotframework/Keywords/CommonKeywords.robot
    import resource  C:/Python37/Lib/site-packages/cumulusci/robotframework/Salesforce.robot
    import resource  C:/Python37/Lib/site-packages/cumulusci/robotframework/CommonVariables.robot

MyAppTestCases.robot

*** Settings ***

Resource  C:/Python37/Lib/site-packages/cumulusci/robotframework/CommonEnvironment.robot

Suite Setup  Call all python libraries and resources
Test Setup  Setup Browser
Test Teardown  End Session

*** Test Cases ***

Verify so and so

    Login to Salesforce
    Launch My App

CommonKeywords.robot

*** Keywords ***

Login to Salesforce

    Wait Until Page Contains Element  ${signOn_username}
    Input Text  ${signOn_username}  ${Username}
    Wait Until Page Contains Element  ${signOn_password}
    Input Text  ${signOn_password}  ${Password}
    Click Element  ${loginButton}

    ${Pass}=  RUN KEYWORD AND RETURN STATUS  Wait Until Page Contains Element'  ${MostRecentlyViewed}

    run keyword if  '${Pass}'=='True'  Log  "SF Home page loaded successfully"
    ...  ELSE  Fail  "SF Home page did not load successfully"

Launch My App

    Open App Launcher   # this is the cumulusci keyword - and it works well now!
    Select App Launcher App  MyApp
    ...
© www.soinside.com 2019 - 2024. All rights reserved.