Robot Frameowrk Get Started

󰃭 2024-10-02

Robot Framework Get Started “SECTION”

Robot Section

Setting

*** Settings ***
Library           SeleniumLibrary
Library           Screenshot
Resource          resources/variables.robot

Detail

  • Library คือ การเรียกใช้ Library ที่ต้องการใช้งาน
  • Resource คือ การเรียกใช้ Resource ที่ต้องการใช้งาน ต้องกำหนดเป็น Path

Variables

*** Variables ***
${BROWSER}         Chrome
${URL}             https://www.google.com
${SEARCH_TEXT}     Robot Framework

Keywords

*** Keywords ***
[Documentation]    Search Google
Open Browser
    Open Browser    ${URL}    ${BROWSER}
Search
    Input Text    name=q    ${SEARCH_TEXT}
    Press Keys    name=q    \13

Detail

  • Keywords คือ การเรียกใช้ Keywords ที่ต้องการใช้งาน
  • Documentation คือ การเรียกใช้ Documentation คือการเขียนคำอธิบายของ Keywords

Test Cases

*** Test Cases ***
Test Google Search
    [Documentation]    Test Google Search

Detail

  • Test Cases คือ การเรียกใช้ Test Cases ที่ต้องการใช้งาน
  • Documentation คือ การเรียกใช้ Documentation คือการเขียนคำอธิบายของ Test Cases

Run Test

robot -d results tests