testing-debugging/slides.tex
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 10 Nov 2010 10:24:03 +0530
changeset 435 975677bf1b8a
parent 403 9858ca9e3f93
child 487 cb3974daced5
permissions -rw-r--r--
Changes to progress.org.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
     1
% Created 2010-11-07 Sun 18:57
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
     2
\documentclass[presentation]{beamer}
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
     3
\usepackage[latin1]{inputenc}
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
     4
\usepackage[T1]{fontenc}
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
     5
\usepackage{fixltx2e}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
     6
\usepackage{graphicx}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
     7
\usepackage{longtable}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
     8
\usepackage{float}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
     9
\usepackage{wrapfig}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    10
\usepackage{soul}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    11
\usepackage{t1enc}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    12
\usepackage{textcomp}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    13
\usepackage{marvosym}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    14
\usepackage{wasysym}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    15
\usepackage{latexsym}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    16
\usepackage{amssymb}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    17
\usepackage{hyperref}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    18
\tolerance=1000
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    19
\usepackage[english]{babel} \usepackage{ae,aecompl}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    20
\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    21
\usepackage{listings}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    22
\lstset{language=Python, basicstyle=\ttfamily\bfseries,
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    23
commentstyle=\color{red}\itshape, stringstyle=\color{red},
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    24
showstringspaces=false, keywordstyle=\color{blue}\bfseries}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    25
\providecommand{\alert}[1]{\textbf{#1}}
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    26
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    27
\title{Testing and debugging}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    28
\author{FOSSEE}
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    29
\date{}
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    30
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    31
\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    32
\begin{document}
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    33
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    34
\maketitle
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    35
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    36
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    37
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    38
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    39
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    40
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    41
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    42
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    43
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    44
\begin{frame}
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    45
\frametitle{Outline}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    46
\label{sec-1}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    47
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    48
\begin{itemize}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    49
\item What software Testing is?
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    50
\item Learn to test simple functions for their functionality.
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    51
\item Learn how to automate tests.
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    52
\item Need for coding style and some of the standards followed by the Python Community.
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    53
\item Handling Errors and Exceptions.
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    54
\end{itemize}
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    55
\end{frame}
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    56
\begin{frame}[fragile]
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    57
\frametitle{gcd function}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    58
\label{sec-2}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    59
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    60
\begin{itemize}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    61
\item Create gcd.py file with:
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    62
\end{itemize}
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    63
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    64
\begin{lstlisting}[language=python]
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    65
  def gcd(a, b):
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    66
        if a % b == 0: 
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    67
            return b
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    68
        return gcd(b, a%b)
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    69
\end{lstlisting}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    70
\end{frame}
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    71
\begin{frame}[fragile]
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    72
\frametitle{Test for gcd.py}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    73
\label{sec-3}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    74
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    75
\begin{itemize}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    76
\item Edit gcd.py file
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    77
\end{itemize}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    78
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    79
\begin{lstlisting}[language=python]
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
    80
403
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    81
  def gcd(a, b):
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    82
      if b == 0:
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    83
          return a
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    84
      return gcd(b, a%b)
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    85
  
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    86
  if __name__=='__main__':
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    87
      result = gcd(48, 64)
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    88
      if result != 16:
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    89
          print "Test failed"
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    90
      print "Test Passed"
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    91
\end{lstlisting}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    92
\end{frame}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    93
\begin{frame}[fragile]
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    94
\frametitle{Automating tests}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    95
\label{sec-4}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    96
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    97
\begin{lstlisting}[language=python]
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    98
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
    99
    if __name=__='__main__':
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   100
    for line in open('numbers.txt'):
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   101
        numbers = line.split()
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   102
        x = int(numbers[1])
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   103
        y = int(numbers[2])
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   104
        result = int(numbers[3])
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   105
        if gcd(x, y) != result:
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   106
            print "Failed gcd test
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   107
                          for", x, y
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   108
\end{lstlisting}
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   109
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   110
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   111
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   112
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   113
$^{1}$ FOOTNOTE DEFINITION NOT FOUND: 0
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   114
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   115
$^{2}$ FOOTNOTE DEFINITION NOT FOUND: 1
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   116
9858ca9e3f93 Adding testing and debugging slides
Amit Sethi
parents: 401
diff changeset
   117
$^{3}$ FOOTNOTE DEFINITION NOT FOUND: 2
401
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
   118
\end{frame}
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
   119
abf092be95ef Adding testing and debugging files
Amit Sethi
parents:
diff changeset
   120
\end{document}