机器人框架:无法添加资源文件“找不到导入文件”

问题描述 投票:0回答:0

我最近开始研究机器人框架。我创建了一个示例项目结构并添加了一个基本测试。我也想测试资源文件的工作。我创建了一个资源文件并尝试将其导入到测试机器人文件中,但我仍然收到“找不到导入文件”

  1. 我尝试将资源文件的扩展名更新为
    .resource
    以及
    .robot
  2. 我将资源文件移动到与我的测试文件相同的文件夹中
  3. 确保我的资源文件中没有测试用例
  4. 多次更新资源文件的引用路径,试过这个答案

代码: 测试文件:

*** Settings ***
Documentation    These tests are written to validate SFDC Object Creation
Library          SeleniumLibrary
Resource         resource_file.resource


*** Test Cases ***
Validate Account creation in SFDC
    User clicks on Account tab from Home Page
    User clicks on New Account
    User enters the required Account information
    User verifies account creation in SFDC

*** Keywords ***
User clicks on Account tab from Home Page
User clicks on New Account
User enters the required Account information
User verifies account creation in SFDC

资源文件

*** Settings ***
Documentation    This Robot File contains all the utility methods
Library    SeleniumLibrary

*** Variables ***
${sfdc_url}                 https://test.salesforce.com
${browser_name}             chrome
${username}                 //input[@type='email']
${password}                 //input[@type='password']
${login_btn}                //input[@id='Login']
${home_button}              //nav[@role='navigation']/descendant::*[text()='Home']


*** Keywords ***
User logs in successfully to SFDC Environment
    Open Browser                     ${sfdc_url}                ${browser_name}
    Maximize Browser Window
    Wait Until Element Is Enabled    ${username}                30
    Input Text                       ${username}                myusername
    Input Password                   ${password}                mypassword
    Click Button                     ${login_btn}
    Wait Until Element Is Enabled    ${home_button}             60

目录结构

venv
|
|
|__tests
|
|
|__resourceFiles
robotframework
© www.soinside.com 2019 - 2024. All rights reserved.