我最近开始研究机器人框架。我创建了一个示例项目结构并添加了一个基本测试。我也想测试资源文件的工作。我创建了一个资源文件并尝试将其导入到测试机器人文件中,但我仍然收到“找不到导入文件”
.resource
以及.robot
代码: 测试文件:
*** 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