KEMBAR78
Scripting robot | PPTX
@chonla 
Aloha! 
September 25, 2014
 Test data format 
 Editor 
 Structure 
 Syntax 
 Setup and Tear down 
Keyword 
Addressing element 
Create a simple test case 
 Running your test cases 
 Data driven test case 
 Try it yourselves 
Q&A
Test cases are in test case files. 
Test case file format can be 
• HTML 
• TSV (Tab Separated Values) 
• Plain Text (This slide covers only this format)
RIDE (https://pypi.python.org/pypi/robotframework-ride) 
• GUI and easy 
Text Editor 
• Simple and fast
Data table 
• Test cases (Required) 
• Settings 
• Keywords 
• Variables 
Table header is written after * character 
• *** Test cases *** 
• *** Test cases 
• *Test cases
Spacing does matter. 
Argument/Value separator 
• At least 2 spaces 
• | (pipe) 
Comment 
• Use # 
Test Keyword 1 2 
Test Keyword | 1 | 2 
#This is comment text
Variable is written as ${VariableName} 
Passing parameters to Keyword 
• Keyword | Parameter 1 | Parameter 2 
• Don’t forget | and spaces are equal.
Settings : Suite Setup/Suite Teardown 
Settings : Test Setup/Test Teardown 
Test Cases : [Setup]/[Teardown] 
Keywords : [Teardown]
Keywords are written under table 
Keywords 
 List of built-in keywords 
• http://rtomac.github.io/robotframework-selenium2library/ 
doc/Selenium2Library.html
identifier=element (id/name) 
id=element (id) 
name=element (name) 
xpath=query (xpath) 
dom=DOM (DOM expression) 
link=href (anchor) 
css=selector (CSS selector) 
jquery=selector (jQuery selector) 
sizzle=selector (sizzle selector) 
tag=HTMLTag (HTML Tag)
What library is required? 
• Selenium2Library
Use pybot <TestCaseFilename> 
Result of testing : report.html 
Log of testing : log.html 
XML Output : output.xml
[Template] is a key of data driven test 
case. 
Create test cases with test data. 
Tell robot to use a keyword as a template 
of test data.
Scenario 1 
• You are about to search for something in Google. 
You have to open your browser. Type in your 
keyword and click search and verify the result 
should contain your query. 
Scenario 2 
• Use robot to post facebook and verify page 
should contain your new post.
Enjoy 
automating!

Scripting robot

  • 1.
  • 2.
     Test dataformat  Editor  Structure  Syntax  Setup and Tear down Keyword Addressing element Create a simple test case  Running your test cases  Data driven test case  Try it yourselves Q&A
  • 3.
    Test cases arein test case files. Test case file format can be • HTML • TSV (Tab Separated Values) • Plain Text (This slide covers only this format)
  • 4.
    RIDE (https://pypi.python.org/pypi/robotframework-ride) •GUI and easy Text Editor • Simple and fast
  • 5.
    Data table •Test cases (Required) • Settings • Keywords • Variables Table header is written after * character • *** Test cases *** • *** Test cases • *Test cases
  • 6.
    Spacing does matter. Argument/Value separator • At least 2 spaces • | (pipe) Comment • Use # Test Keyword 1 2 Test Keyword | 1 | 2 #This is comment text
  • 7.
    Variable is writtenas ${VariableName} Passing parameters to Keyword • Keyword | Parameter 1 | Parameter 2 • Don’t forget | and spaces are equal.
  • 8.
    Settings : SuiteSetup/Suite Teardown Settings : Test Setup/Test Teardown Test Cases : [Setup]/[Teardown] Keywords : [Teardown]
  • 9.
    Keywords are writtenunder table Keywords  List of built-in keywords • http://rtomac.github.io/robotframework-selenium2library/ doc/Selenium2Library.html
  • 10.
    identifier=element (id/name) id=element(id) name=element (name) xpath=query (xpath) dom=DOM (DOM expression) link=href (anchor) css=selector (CSS selector) jquery=selector (jQuery selector) sizzle=selector (sizzle selector) tag=HTMLTag (HTML Tag)
  • 11.
    What library isrequired? • Selenium2Library
  • 12.
    Use pybot <TestCaseFilename> Result of testing : report.html Log of testing : log.html XML Output : output.xml
  • 13.
    [Template] is akey of data driven test case. Create test cases with test data. Tell robot to use a keyword as a template of test data.
  • 15.
    Scenario 1 •You are about to search for something in Google. You have to open your browser. Type in your keyword and click search and verify the result should contain your query. Scenario 2 • Use robot to post facebook and verify page should contain your new post.
  • 16.