3

Problem Description

I am unable to split a String in tokens as explained in the guide here It keeps throwing "No keyword with name 'Split String' found" and I am unsure as to what I have done wrong. Obviously I must be missing something I can't see.

I use this command to run the test: 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 Browser

resource.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 is complaining about 'Split String' as part of this block below

Apply Policies
    [Arguments]     ${ALL_POLICIES_COMMA_SEPARATED}
    @{POLICIES}=    Split String       ${ALL_POLICIES_COMMA_SEPARATED}     ,${SPACE} 
    :FOR    ${POLICY}    IN    @{POLICIES}
    Apply Policy  ${POLICY}

Stating the following error:

No keyword with name 'Split String' found.

I am running on this version

$ robot --version
Robot Framework 3.2.1 (Python 2.7.16 on win32)
2
  • 1
    It doesn't appear that you're importing the String library anywhere. Commented Jul 7, 2020 at 15:53
  • My bad. I thought that library was core to the framework. Thank you Commented Jul 7, 2020 at 17:34

1 Answer 1

5

Even though the String library comes with robot framework, you must import it into a test file in order to use the keywords.

For example:

*** Settings ***
Library    String
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.