Python Automation Testing Presentation
Python Automation Testing Presentation
Python Automation Testing Presentation
Introduction to • fast,
• scalable,
• versatile,
Python • popular,
• ever-growing,
• widely supported,
• easy to write,
• intuitive to read,
• quick to develop,
• simple to maintain.
Automated testing is a well-known context in the
world of testing. It is where the test plans are
being executed using script instead of a human.
Why use Python Python comes with the tools and libraries that
support automated testing for your system.
for Automation
Testing? Python Test cases are comparatively easy to write.
With the increased use of Python, Python-based
test automation frameworks are also becoming
popular.
Robot
PyTest
PyUnit
Python Testing
Frameworks: Behave
Lettuce
What is Behave?
Behave is Python style behavior-driven development. Behavior-
driven development (or BDD) is an agile software development
technique that uses tests written in a natural language style,
backed up by Python code.
to Behave
technical or business participants in a software project.
Downloads and Install Install Behave in Command line using pip install behave
Installations Install Install selenium in Command line using pip install selenium
Virtual
Python, we can setup different environments, called Virtual
Environments in our system.
Environment
Each environment will be its own virtual space. All packages
installed within that space would not interfere with packages
outside the environment and will be contained only inside this
space.
Virtualenv
Pipenv
Pew
Venv
‘Pipenv’ helps in installing Python packages using Pip and helps to
keep Python packages of different projects isolated from one
another.
Why use
It is a combination of three tools such as Pyenv, pip and Virtualenv.
‘Pipenv’
and its related tools.
• Pip fetches and installs Python packages.
• Virtualenv allows users to keep the Python packages of different
Virtual
projects isolated from one another.
• Pipenv is a tool that puts all these tools together. It takes care of
calculating the complete set of dependencies. In installation
Environment?
mode, it tells virtualenv and pip where to install the
dependencies. In runtime mode, it makes an environment
available with the right version of the Python interpreter (via
pyenv) and the right set of packages (via virtualenv).
Install ‘pipenv’ Virtual
Environment:
How to install Pip install pipenv
Why use 1. before_step (context, step), after_step (context, step) - These run
before and after every step.
Environment
2. before_scenario (context, scenario), after_scenario (context,
scenario) - These run before and after each scenario is run.
3. before_feature (context, feature), after_feature (context, feature) -
Controls file? These run before and after each feature file is executed.
4. before_tag (context, tag), after_tag (context, tag) - These run
before and after a section tagged with the given name. They are
invoked for each tag encountered in the order they’re found in the
feature file.
5. before_all (context), after_all (context) - These run before and after
all the tests are executed.
Behave Project Structure: