Akop Akopov
Akop Akopov

Reputation: 85

robot framework doesn't see user defined keywords if they are in the same file as testcase

Hi ' I'm newbie in robot framework. I try to declare keywords in the same file as testcases. But robotframework doesn't see them. I use robotframework 3.2.2 Please advice:

*** Settings ***
Library  SeleniumLibrary

*** Variables ***


*** Test Cases ***
User must sign in to check out
[Documentation] This is some basic info about the test
[Tags] Smoke
    Begin Web Test
    Search for Products
    Select Product from Search Results
    Add product to Cart
    Begin checkout
    End Web Test

*** Keywords ***
Begin Web Test
    Open Browser  about:blank  ie

Search for Products
    Go To   http://amazon.com
    Wait Until Page Contains  Today's Deals
    Input Text  Ferrari 458
    Click Button  xpath=//*[@id="nav-search-submit-text"]/input
    Wait Until Page Contains  results for "Ferrari 458"

Select Product from Search Results
    Click Link  xpath=//*[@id="search"]/div[1]/div[2]/div/span[3]/div[2]/div[2]/div/span/div/div/div[2]/h2/a
    Wait Until Page Contains  Back to results

Add product to Cart
    Click Button  id=add-to-cart-button
    Wait Until Page Contains  Added to Cart

Begin checkout
    Click Link  Proceed to checkout (1 item)
    Wait Until Page Contains  Continue

End Web Test
    Close Browser

Upvotes: 0

Views: 410

Answers (1)

Matthew King
Matthew King

Reputation: 644

[Documentation] and [Tags] need to be indented.

There should be at least 2 spaces between [Documentation] and "This is some basic info about the test"

There should also be at least 2 spaces between [Tags] and Smoke

User must sign in to check out
   [Documentation]  This is some basic info about the test
   [Tags]  Smoke
   Begin Web Test
   Search for Products
   Select Product from Search Results
   Add product to Cart
   Begin checkout
   End Web Test

Upvotes: 1

Related Questions