QA Automation/Robot Framework
Keywords Section
kokorii_
2024. 5. 6. 19:10
1. Keyword Section 기본 사용1
*** Settings ***
Documentation This is my first test case
Library OperatingSystem
Library Collections
*** Keywords ***
Log My Username
Log ${DICTIONARY}[username]
Log My Password
Log ${DICTIONARY}[password]
Log Username And Password 1
Log ${DICTIONARY}[username]
Log ${DICTIONARY}[password]
Log Username And Password 2
Log My Username
Log My Password
*** Variables ***
${my_var} my test variable
${second_var} this is second
@{List} test1 test2 test3 test4
&{DICTIONARY} username=testUser password=qwerty123!
*** Test Cases ***
TEST
[Tags] Demo
Log My Username
#Log ${DICTIONARY}[username]
Log My Password
#Log ${DICTIONARY}[password]
Log Username And Password 1
Log Username And Password 2
2. Keyword 기본 사용2
*** Settings ***
Documentation This is my first test case
Library OperatingSystem
Library Collections
*** Keywords ***
Log My Username
Log ${DICTIONARY}[username]
Log My Password
Log ${DICTIONARY}[password]
*** Variables ***
${my_var} my test variable
${second_var} this is second
@{List} test1 test2 test3 test4
&{DICTIONARY} username=testUser password=qwerty123!
*** Test Cases ***
TEST
[Tags] Demo
Log My Username
#Log ${DICTIONARY}[username]
Log My Password
#Log ${DICTIONARY}[password]
3. 사전에 미리 정의 된 키워드를 뒤에 선언하는 키워드에 사용할 수 있다
*** Settings ***
Documentation This is my first test case
Library OperatingSystem
Library Collections
*** Keywords ***
Log My Username
Log ${DICTIONARY}[username]
Log My Password
Log ${DICTIONARY}[password]
Log Username And Password 1
Log ${DICTIONARY}[username]
Log ${DICTIONARY}[password]
Log Username And Password 2
Log My Username
Log My Password
*** Variables ***
${my_var} my test variable
${second_var} this is second
@{List} test1 test2 test3 test4
&{DICTIONARY} username=testUser password=qwerty123!
*** Test Cases ***
TEST
[Tags] Demo
Log My Username
#Log ${DICTIONARY}[username]
Log My Password
#Log ${DICTIONARY}[password]
Log Username And Password 1
Log Username And Password 2
4. 아규먼트를 이용하여 함수처럼 스태틱이 아닌 동적 변수를 할당할 수 있다
- syntax to make a keyword globally available
*** Settings ***
Documentation This is my first test case
Library OperatingSystem
Library Collections
*** Keywords ***
Log My Specific Username
[Arguments] ${USERNAME}
Log ${USERNAME}
*** Variables ***
${my_var} my test variable
${second_var} this is second
@{List} test1 test2 test3 test4
&{DICTIONARY} username=testUser password=qwerty123!
&{DICTIONARY2} username=user2 password=secondpwd
*** Test Cases ***
TEST
[Tags] Demo
Log Username And Password 2
Log My Specific Username ${DICTIONARY}[username]
Log My Specific Username ${DICTIONARY2}[username]
5. 여러개의 아규먼트(argument) 사용하기
*** Settings ***
Documentation This is my first test case
Library OperatingSystem
Library Collections
*** Keywords ***
Log Username And Password 1
Log ${DICTIONARY}[username]
Log ${DICTIONARY}[password]
Log Username And Password 2
Log My Username
Log My Password
Log My Specific Username
[Arguments] ${USERNAME}
Log ${USERNAME}
Log My Specific Username And Password
[Arguments] ${USERNAME2} ${PASSWORD}
Log ${USERNAME2}
Log ${PASSWORD}
*** Variables ***
${my_var} my test variable
${second_var} this is second
@{List} test1 test2 test3 test4
&{DICTIONARY} username=testUser password=qwerty123!
&{DICTIONARY2} username=user2 password=secondpwd
*** Test Cases ***
TEST
[Tags] Demo
Log My Specific Username And Password ${DICTIONARY}[username] ${DICTIONARY}[password]
Log My Specific Username And Password ${DICTIONARY2}[username] ${DICTIONARY2}[password]
Log My Specific Username ${DICTIONARY}[username]
Log My Specific Username ${DICTIONARY2}[username]
6. Keyword Combination
*** Settings ***
Documentation This is my first test case
Library OperatingSystem
Library Collections
*** Keywords ***
Log My Username
[Arguments] ${USERNAME}
Log ${USERNAME}
Log My Password
[Arguments] ${PASSWORD}
Log ${PASSWORD}
Log My Specific Username And Password
[Arguments] ${USERNAME2} ${PASSWORD}
Log My Username ${USERNAME2}
Log My Password ${PASSWORD}
*** Variables ***
${my_var} my test variable
${second_var} this is second
@{List} test1 test2 test3 test4
&{DICTIONARY} username=testUser password=qwerty123!
&{DICTIONARY2} username=user2 password=secondpwd
*** Test Cases ***
TEST
[Tags] Demo
Log My Specific Username And Password ${DICTIONARY}[username] ${DICTIONARY}[password]
Log My Specific Username And Password ${DICTIONARY2}[username] ${DICTIONARY2}[password]