Search code examples
robotframeworkui-automationbrowser-automation

Robot Framework Test Template Setup argument problems


I've got several working Robot Framework tests that I'm trying to consolidate into one test suite and run through a template. The tests are functionally the same, just being executed from a different URL. So that's the one parameter that's different. I'm trying to pass the URL into each test case, but I am getting an error: "Keyword 'Setup' expected 0 arguments, got 2."

*** Settings ***
Documentation       Login tests
Library             Zoomba.GUILibrary
Suite Setup         Setup
Test Template       Template 1

*** Variables ***
${browser}          chrome
${url1}             https://<test.url1>
${url2}             https://<test.url2>
${url3}             https://<test.url3>

*** Keywords ***
Setup
     Open Browser               ${url}  browser=${browser}  options=add_argument("<argument>")
     Maximize Browser Window 
     Set Selenium Speed         0.2s
     Log To Console             Setup complete. Logging in...

Template 1
    [Arguments]                 ${url}  ${browser}=${browser}
    Setup                       ${url}  ${browser}
    <Login tests>

*** Test Cases ***
Site 1 Login
    ${url1}

Site 2 Login
    ${url2}

Site 3 Login
    ${url3}

Anybody have any ideas? Please let me know, thanks!


Solution

  • You are calling Setup with two arguments, like the error says:

    Template 1
        [Arguments]                 ${url}  ${browser}=${browser}
        Setup                       ${url}  ${browser}
        <Login tests>