问题描述
正如指南这里中所解释的那样,我无法在令牌中拆分字符串--它总是抛出"No关键字和名称‘拆分字符串’找到“,我也不确定我做错了什么。显然我错过了一些我看不见的东西。
我使用以下命令运行测试:robot publish-api-mule.robot
publish-api.robot
*** Settings ***
Documentation Publish an API in Mule Server
Resource resource.robot
*** Test Cases ***
Valid Login
Open Browser To Login Page
Input Username <username%%%%%%%>
Input Password <passwprd%%%%%%%%>
Submit Credentials
Welcome Page Should Be Open
CLick on API Manager
Select Environment TEST
Click on Manage from API Exchange
Input API to Deploy and Save customer-api-services
Select API Version 1.0.4
Select Asset Version 5.0.2
Save and Publish API
Copy API ID and Autodiscovery hash
Apply Policies logging-init-policy, common-response-headers-policy, Client_id Enforcement policy, jwt-validation-policy
Share Details in JIRA via Comment SAPIM-52
[Teardown] Close Browserresource.robot
*** Settings ***
Documentation A resource file with reusable keywords and variables.
...
... The system specific keywords created here form our own
... domain specific language. They utilize keywords provided
... by the imported SeleniumLibrary.
Library SeleniumLibrary
*** Variables ***
@{POLICIES} []
${SERVER} anypoint.mulesoft.com
${BROWSER} Chrome
${DELAY} 0
${LOGIN URL} https://${SERVER}/login
${JIRA_API_ID} -
${JIRA_AUTODISCOVERY_HASH} -
${API_ID} -
${AUTODISCOVERY_HASH} -
*** Keywords ***
Open Browser To Login Page
Open Browser ${LOGIN URL} ${BROWSER}
Maximize Browser Window
Set Selenium Speed ${DELAY}
Login Page Should Be Open
Login Page Should Be Open
Title Should Be Anypoint Platform
Go To Login Page
Go To ${LOGIN URL}
Login Page Should Be Open
Input Username
[Arguments] ${USERNAME}
Input Text //*[@id="appRoot"]/main/div/div/div/div[1]/form/div[1]/div/div/input ${USERNAME}
Input Password
[Arguments] ${PASSWORD}
Input Text password ${PASSWORD}
Submit Credentials
Click Element //*[@id="appRoot"]/main/div/div/div/div[1]/form/button
Welcome Page Should Be Open
Title Should Be Anypoint Platform
CLick on API Manager
Wait Until Element Is Enabled //*[@id="appRoot"]/div/div/section[1]/div/div[2]/div/ol/li[2]/a/div/span[1]
Click Element //*[@id="appRoot"]/div/div/section[1]/div/div[2]/div/ol/li[2]/a/div/span[1]
Select Environment
[Arguments] ${ENVIRONMENT}
Wait Until Element Is Enabled //div[contains(text(),'${ENVIRONMENT}')]
Click Element //div[contains(text(),'${ENVIRONMENT}')]
Click on Manage from API Exchange
Wait Until Element Is Enabled //*[@id="contentWrapper"]/ui-view/ui-view/div/div/div/div[2]/div[1]/div[1]/button/div[2]
Click Element //*[@id="contentWrapper"]/ui-view/ui-view/div/div/div/div[2]/div[1]/div[1]/button/div[2]
Wait Until Element Is Enabled //*[@id="contentWrapper"]/ui-view/ui-view/div/div/div/div[2]/div[1]/div[1]/ul/li[1]/a
Click Element //*[@id="contentWrapper"]/ui-view/ui-view/div/div/div/div[2]/div[1]/div[1]/ul/li[1]/a
Input API to Deploy and Save
[Arguments] ${API NAME}
Set Focus To Element //*[@id="am-get-from-exchange-container"]/div/form/div[1]/div[1]/div/div/div
Wait Until Element Is Enabled //*[@id="am-get-from-exchange-container"]/div/form/div[1]/div[1]/div/div/div
Input Text //*[@id="react-select-2--value"]/div[2]/input ${API NAME}
Sleep 2s
Mouse Down //*[contains(text(), "${API NAME}")]
Press Keys xpath=//body TAB
Select API Version
[Arguments] ${API VERSION}
Wait Until Element Is Enabled //*[@id="am-get-from-exchange-container"]/div/form/div[1]/div[3]/div/div/div
Click Element //*[@id="am-get-from-exchange-container"]/div/form/div[1]/div[3]/div/div/div
Wait Until Element Is Enabled //*[contains(text(),'${API VERSION}')]
Click Element //*[contains(text(),'${API VERSION}')]
Select Asset Version
[Arguments] ${ASSET VERSION}
Wait Until Element Is Enabled //*[@id="am-get-from-exchange-container"]/div/form/div[1]/div[4]/div/div/div/div/span[2]/span
Click Element //*[@id="am-get-from-exchange-container"]/div/form/div[1]/div[4]/div/div/div/div/span[2]/span
Wait Until Element Is Enabled //*[contains(text(),'${ASSET VERSION}')]
Click Element //*[contains(text(),'${ASSET VERSION}')]
Save and Publish API
Click Element //*[@id="save-button"]/span
Wait Until Element Is Enabled //*[@id="contentWrapper"]/ui-view/ui-view/div/div/div/ap-api-version-header/div[1]/div/div[1]/div/div[1]/span
Copy API ID and Autodiscovery hash
${API_ID}= Get Text //*[@id="contentWrapper"]/ui-view/ui-view/div/div/div/ap-api-version-header/div[1]/div/div[2]/div[2]/div[1]/span[2]
Set Suite Variable ${JIRA_API_ID} ${API_ID}
Wait Until Element is Enabled //*[@id="autodicovery-props"]/span/div/button
${AUTODISCOVERY_HASH}= Get Element Attribute //*[@id="autodicovery-props"]/span/div/button attribute=data-clipboard-text
Set Suite Variable ${JIRA_AUTODISCOVERY_HASH} ${AUTODISCOVERY_HASH}
Apply Policy
[Arguments] ${POLICY_NAME}
Click Element //*[@id="contentWrapper"]/div/ap-left-sidebar/div/ul[2]/li[3]/a
Wait Until Element is Enabled //*[@id="contentWrapper"]/ui-view/ui-view/div/div/ui-view/div/div[3]/div/div[1]/button
Click Element //*[@id="contentWrapper"]/ui-view/ui-view/div/div/ui-view/div/div[3]/div/div[1]/button
Mouse Down //label[contains(text(), "${POLICY_NAME}-v${POLICY_VERSION}")]
Click Element /html/body/div[7]/div/div/div[3]/button[2]
Apply Policies
[Arguments] ${ALL_POLICIES_COMMA_SEPARATED}
@{POLICIES}= Split String ${ALL_POLICIES_COMMA_SEPARATED} ,${SPACE}
:FOR ${POLICY} IN @{POLICIES}
Apply Policy ${POLICY}
Share Details in JIRA via Comment
[Arguments] ${JIRA NUMBER}
Go to https://jira-sdop.us.corp/browse/${JIRA NUMBER}
Wait Until Element is Enabled //*[@id="dprAdapters"]
Select From List By Index //*[@id="dprAdapters"] 3
Submit Form
Wait Until Element is Enabled footer-comment-button
Click Element footer-comment-button
Wait Until Element Is Enabled //*[@id="comment"]
Sleep 1s
Input Text //*[@id="comment"] ${JIRA_API_ID} \n\n ${JIRA_AUTODISCOVERY_HASH}
Click Element //*[@id="issue-comment-add-submit"]Robotframework抱怨“拆分字符串”是下面块的一部分
Apply Policies
[Arguments] ${ALL_POLICIES_COMMA_SEPARATED}
@{POLICIES}= Split String ${ALL_POLICIES_COMMA_SEPARATED} ,${SPACE}
:FOR ${POLICY} IN @{POLICIES}
Apply Policy ${POLICY}声明以下错误:
No keyword with name 'Split String' found.,我在这个版本的上运行
$ robot --version
Robot Framework 3.2.1 (Python 2.7.16 on win32)发布于 2020-07-07 19:06:58
尽管String库附带了机器人框架,但为了使用关键字,必须将其导入测试文件。
例如:
*** Settings ***
Library Stringhttps://stackoverflow.com/questions/62779130
复制相似问题