Python Test Automation

Duration: 5 Days

Course Objectives:

To become proficient with Python programming language and use it to create scripts to automate testing procedures.

Audience:

This course is designed for software Quality Assurance professionals.

 

Course Outline:

Python Language

·         Hardware and Software

·         Binary Counting

·         Machine Code

·         Compilers and Interpreters

·         Python

·         Writing to stdout: print

·         Literals (Strings) and Numbers

·         Operators: + * =

Output

·         Executing a Python program

·         Syntax: code blocks, colons

·         if, elif and else

·         while and another else

·         Writing to stdout

·         Relational and logical operators

Input

  • Input from stdin
  • Factory functions
  • Catching an exception:
    • yet another else
  • Formatted strings
  • Integer division issue

for range

·         range operator

·         for loop

·         tuples

Functions

·         Function protocols

·         import and reload

·         Module: random

·         Introspection

Scope

·         Indentifier scope

·         Default arguments

·         Keyword arguments

Sequences

·         Sequence types: str, tuple, list

·         Sequence slicing and other manipulations

Important Trick

  • Module: sys
  • Important trick:
    • _name_and_'_main_'
  • Valid identifiers

Comprehensions

·         Scope issues

·         List comprehensions

Dictionaries

·         Importing with from

·         Dictionaries

File IO

·         File I/O

·         Module: os

·         Walking A Directory

Packages

·         Modules: shutil, tempfile

·         Python Packages

·         Debugging 

Dynamic Code

·         Dynamic Code Generation

·         Modules:

    • subprocess
    • glob
    • profile¬†

Function Fancies

·         Function protocols: variable length argument lists

·         Formatted printing using a dictionary for replacement

·         Unpacking sequences and dictionaries

·         Generators (Optional)

·         Decorators (Optional)

OOP

·         Module: shelve

·         Classes

·         Inheritance

·         Class variable

Overriding

·         Overriding

·         Has-A vs Is-A relationships

New Style Classes

·         Useful attributes

·         Iterators

·         New style classes

·         Attribute control (Optional)

·         property (Optional)

·         Static methods (Optional)

·         Class methods (Optional)

·         Diamond inheritance (Optional)

Developer Modules

·         Context Manager class

·         Module: unittest

·         Module: optparse

re Module

·         re - Regular Expressions

·         Search and replace

·         Named groups

·         Regular expression syntax

·         Testing regular expressions

Python Unit Testing

·         About unit testing

·         Test fixtures

·         Test cases

·         Test suite

·         Test runner

Wrap Up

·         Exceptions

·         Namespaces

·         Nests

·         Pitfalls

 

·         Finding Modules and Help