Giter Site home page Giter Site logo

qas-python-robot-sample's Introduction

Python Robot

Pre-requisites

1.Python and PIP should be installed 2.Using PIP install requirements.txt by following command

Python must be above 3.0 version.you can use pip with `alias name` like 3 etc based on your python installed.

pip(Alias Name) install -r requirements.txt

Compatible chromedriver path should be set in your system and in application.properties file if it is present in your project folder for command line execution.

# use automationName='XCUITest' if needed in IOS device during command line execution

Writing Features inside Scenario

*** Test Cases ***
Valid Login
    Open Browser To Login Page
    Input Username    demo
    Input Password    mode
    Submit Credentials
    Welcome Page Should Be Open
    [Teardown]    Close Browser

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(Alias Name) install robotframework
pip(Alias Name) install robotframework-seleniumlibrary
pip(Alias Name) install robotframework-appiumlibrary

Running tests

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

robot 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 file and use various command line options supported by Robot Framework::

robot tests/<platform>/<filename>.robot
robot --test <TestCaseName> --loglevel DEBUG tests

Tag wise execution robot -i tagName -i differentTagName tests

You can also run an individual test case from file and command line option supported by Robot Framework::

robot -t testCaseName tests/<platform>/<filename>.robot
In case testCaseName with whitespace than replace whitespace with '_'(Ex. testCaseName : Amazon Invalid Login,than use testCaseName as Amazon_Invaid_Login)

Run robot --help for more information about the command line usage

Using different browsers

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

robot --variable BROWSER:Firefox tests
robot --variable BROWSER:IE tests

Consult SeleniumLibrary documentation about supported browsers. Also, You can find available Keywords in Keyword Documentation

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:

  • report.html
  • log.html

Upload Results to QTM or QTM4J

For uploading results to QTM or QTM4J, you need to run using below command which will generate xUnit compatible output file and listener python_listerner.py will upload that file to respective tool.

robot --listener python_listener.py --xunit result.xml tests

Read more

Robot Framework, Python, pip

qas-python-robot-sample's People

Contributors

arpiitkhatri0910 avatar nidhishah2381 avatar qmetrydev avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.