• Stars
    star
    225
  • Rank 177,187 (Top 4 %)
  • Language RobotFramework
  • Created almost 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Robot Framework web testing demo using SeleniumLibrary

Web testing with Robot Framework and SeleniumLibrary

Robot Framework is a generic open source test automation framework and SeleniumLibrary is one of the many test libraries that can be used with it. In addition to showing how they can be used together for web testing, this demo introduces the basic Robot Framework test data syntax, how tests are executed, and how logs and reports look like.

Downloading demo package

To get the demo, you can either download the repository from GitHub or checkout the source code directly. As a result you get WebDemo directory with demoapp and login_tests sub directories.

Example test cases and generated results are available also online. There is thus no need to download the demo if you are not interested in running it yourself.

Demo application

The demo application is a very simple login page shown below. With user name demo and password mode you get into a welcome page, and otherwise you end up to an error page. How to start and stop the application yourself is explained in the Starting demo application section.

demoapp.png

Test cases

Test case files as well as a resource file used by them are located in the login_tests directory. Click file names below to see the latest versions online.

valid_login.robot

A test suite with a single test for valid login.

This test has a workflow that is created using keywords in the imported resource file.

invalid_login.robot

A test suite containing tests related to invalid login.

These tests are data-driven by their nature. They use a single keyword, specified with the Test Template setting, that is called with different arguments to cover different scenarios.

This suite also demonstrates using setups and teardowns in different levels.

gherkin_login.robot

A test suite with a single Gherkin style test.

This test is functionally identical to the example in the valid_login.robot file.

resource.robot

A resource file with reusable keywords and variables.

The system specific keywords created here form our own domain specific language. They utilize keywords provided by the imported SeleniumLibrary.

See Robot Framework User Guide for more details about the test data syntax.

Generated results

After running tests you will get report and log in HTML format. Example files are also visible online in case you are not interested in running the demo yourself:

Running demo

Preconditions

A precondition for running the tests is having Robot Framework and SeleniumLibrary installed, and they in turn require Python. Robot Framework installation instructions cover both Robot and Python installations, and SeleniumLibrary has its own installation instructions.

In practice it is easiest to install Robot Framework and SeleniumLibrary along with its dependencies using pip package manager. Once you have pip installed, all you need to do is running these commands:

pip install -r requirements.txt

Starting demo application

Running tests requires the demo application located under demoapp directory to be running. It can be started either by double clicking demoapp/server.py file in a file manager or by executing it from the command line:

python demoapp/server.py

After the demo application is started, it is be available in URL http://localhost:7272. You can test it manually, valid credentials are demo/mode, and it needs to be running while executing the automated tests.

If the application was started by double-clicking demoapp/server.py file, it can be shut down by closing the opened window. If it was executed from the command line, using Ctrl-C is enough.

Running tests

The test cases are located in the login_tests directory. They can be executed using the robot command:

robot login_tests

Note

If you are using Robot Framework 2.9 or earlier, you need to use the pybot command instead.

You can also run an individual test case file and use various command line options supported by Robot Framework:

robot login_tests/valid_login.robot
robot --test InvalidUserName --loglevel DEBUG login_tests

Run robot --help for more information about the command line usage and see Robot Framework User Guide for more details about test execution in general.

Using different browsers

The browser that is used is controlled by ${BROWSER} variable defined in resource.robot resource file. Firefox browser is used by default, but that can be easily overridden from the command line:

robot --variable BROWSER:Chrome login_tests
robot --variable BROWSER:IE login_tests

Consult SeleniumLibrary documentation about supported browsers.

More Repositories

1

robotframework

Generic automation framework for acceptance testing and RPA
Python
9,674
star
2

SeleniumLibrary

Web testing library for Robot Framework
Python
1,382
star
3

RIDE

Test data editor for Robot Framework
Python
958
star
4

HowToWriteGoodTestCases

General guidelines for writing good test cases using Robot Framework
408
star
5

QuickStartGuide

Robot Framework Quick Start Guide
Python
279
star
6

PythonRemoteServer

Robot Framework remote server implemented with Python
Python
150
star
7

SSHLibrary

Robot Framework test library for SSH and SFTP
Python
148
star
8

RobotDemo

Robot Framework demo
Python
103
star
9

robotframework.github.com

Robot Framework ecosystem from page
Vue
76
star
10

PythonLibCore

Tools to ease creating larger test libraries for Robot Framework using Python
Python
63
star
11

Selenium2Library

Web testing library for Robot Framework that has been renamed to SeleniumLibrary
Python
62
star
12

Rammbock

Rammbock - generic network protocol tester
Python
62
star
13

DbBot

DbBot is a tool to serialize Robot Framework test run results into a SQLite database.
Python
60
star
14

jrobotremoteserver

Serves remote test libraries for Robot Framework that are implemented in Java.
Java
44
star
15

JavalibCore

Base for implementing Java test libraries to be used with Robot Framework
Java
42
star
16

RemoteInterface

Introduction to the remote interface with a list of available remote servers
33
star
17

remoteswinglibrary

RemoteSwingLibrary
Python
31
star
18

DosDontsSlides

Robot Framework Dos and Don'ts
RobotFramework
26
star
19

statuschecker

Tool for validating that executed Robot Framework test cases have expected statuses and log messages.
Python
26
star
20

MavenPlugin

Maven plugin for using the Robot Framework
Java
24
star
21

swingexplorer

A project to host the swingexplorer jar files
21
star
22

BeginnersGuide

HTML
19
star
23

LibraryApiExamples

Executable examples demonstrating Robot Framework test library API.
Python
16
star
24

visual-identity

Guidelines and assets related to Robot Framework's visual identity
16
star
25

rfdoc

Automatically exported from code.google.com/p/rfdoc
Python
15
star
26

Generator

Script which generates a test project containing test libraries, test suites and resources.
Python
15
star
27

IntroSlides

Robot Framework Introduction slide set
RobotFramework
15
star
28

robotbackgroundlogger

Logger to test libraries that supports logging from threads
Python
13
star
29

OldSeleniumLibrary

Deprecated Selenium library for Robot Framework
Python
13
star
30

RemoteApplications

A Robot Framework test library that enables using libraries in external JVM.
Java
12
star
31

mabot

Automatically exported from code.google.com/p/robotframework-mabot
Python
12
star
32

JoyRide

Eclipse plugin for Robot Framework space separated data files
Java
12
star
33

HTMLChecker

Robot Framework test library for running checks and validations on HTML files
Python
12
star
34

robocon

HTML
10
star
35

pygmentslexer

Python
6
star
36

foundation

Robot Framework Foundation web pages
Vue
6
star
37

rellu

Tooling to ease creating releases
Python
6
star
38

JavatoolsTest

JDave extensions for testing Robot Framework libraries
Java
4
star
39

live

Live running Robot Framework examples that can be executed in Browser.
2
star
40

rpa

JavaScript
2
star