RobotFramework Having keywords and Test template

Viewed 372

I am using Robotframework and trying to write a Test case which need's Template as well as some keywords.. Below is something which i am currently working on .. Template cannot be inside Settings because there are different Test-cases and each of them have different use cases.

When trying to run TC_003_Edit_Custom_Destination it is throwing me error which is
Keyword 'Create Destination Invalid Scenarios' expected 4 arguments, got 1.

TC_003_Edit_Custom_Destination
    [Documentation]     Edit Custom Destination, inside settings tab
    [Tags]              Testing Edit Custom Destination Functionality
    TC_001_Streaming_test_setup  other
    Cancel create Destination
    Click on edit title for new destination created  ${destination_title_name}
    [Template]          Create Destination Invalid Scenarios

                   ${empty}                           ${empty}                            ${empty}          Please enter an RTMP address
                   ${empty}                           ${rtmps_address}                    ${empty}          Please enter an stream key
                   ${empty}                           rtm://google.com                    123ABC            Invalid Destination
                   ${empty}                           ${rtmps_address}                    123ABC            Please give this destination a name
                   ${destination_title_name}          ${rtmps_address}                    123ABC            ${empty}

Does anyone know how can i add keywords and also test-template together inside TestCase ? I don't want to pack TC_001_Streaming_test_setup other Cancel create Destination inside [Setup]

____ Update ____

*** Test Cases ***

Test Case with Template    
    [Template]    Template_1
    ${template_args_1}   ${template_args_2}

    Some_keywords_1 
    Some_keywords_2
    Some_keywords_3  
1 Answers

If I understand correctly, you want test cases with templates and test cases without template in the same suite.

That can be achieved by setting the template at the test level as for my example below where you have 3 test cases, 2 with different templates and 1 without any template.

*** Test Cases ***
Test Case with Template    
    [Template]    I Will use this template
    This is the first execution variable
    This is the second execution

Test using another Template    
    [Template]    Use this template instead
    This uses a different template

Test Without Template
    Log    This test case doesn't use template!


*** Keywords ***
I Will use this template
    [Arguments]    ${templateVar1}
    Log    My variable value is ${templateVar1}

Use this template instead
    [Arguments]    ${anotherVar}
    Log    This is the other template value: ${anotherVar}
Related