Skip to content

Mays-M/RobotFramework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Robot Framework is released under the Apache License 2.0. Development of Robot Framework is sponsored by the Robot Framework Foundation. The basis for Robot Framework is Pekka Klärck’s Master’s thesis for Helsinki University of Technology in 2006.

If you live in Finland, this tool is especially useful as many finnish companies use it.

Keywords

  • Keywords are like functions that you execute to accomplish various tests.

  • Keywords can be reused and composed, which means that you create keywords by calling other keywords

    Library keywords

  • Library keywords are the lowest level building blocks of creating user keywords and using them in test cases.

  • Libraries are normally imported in the Settings section but can also be imported in the Test Cases section using the Import Library keyword from the BuiltIn Library

Defining variables

  • Variables, as keywords, are case-insensitive, and spaces and underscores are ignored.
  • Recommendation is to use CAPITAL letters with global variables like ${PATH} and small letters with local variables like ${name}.
  • Variable names have type identifiers and variable names between the mandatory curly braces like ${VAR}.
  • Robot Framework has scalars ${SCALAR}, lists @{LIST} and dictionaries &{DICT}. Environment variables are used as strings with %{ENV_VAR}.

Web testing with Robot Framework and SeleniumLibrary

  1. Install Python: Download Python

  2. On Windows, navigate to cmd and type:

    # To verify that Python is installed
    python --version
    
    # To install Robot Framework
    pip install robotframework
    
    # To verify that Robot Framework is installed
    robot --version
    
    # To install the Selenium library
    pip install robotframework-selenium2library
    
    # To check the library list
    pip list
    
  3. Download Web Testing Demo the repository from GitHub . As a result you’ll get directory WebDemo-master and demoapp , docs and login_tests subdirectories:

    web_Demo

  4. Requirements for this demo are having Python, Pip, Robot Framework and SeleniumLibrary installed. This demo includes requirements.txt -file so we just need to give command:

     pip install -r requirements.txt
    
  5. install browser and operating system specific browser drivers for all those browsers you want to use in tests: pip install seleniumbase

  6. Next we start the demo application with command:

    Manually testing

      python demoapp/server.py
    

Extensions

Open browserand navigate to http://localhost:7272 .

The demo application is a very simple login page. With user name demo and password mode you get into a welcome page and otherwise you end up on an error page.

Now try to login to manually test, end the server by pressing ctrl-c.

Extensions

Automated test using robot

  • so let’s start it again.
  • Locate demoapp/server.py from your file manager and Run it with python
  • next run automated tests with cmd:
     robot login_tests
    

Extensions

Result of the Test

Report.html

Extensions

log.html

Extensions