testing-debugging/slides.tex
author anand
Thu, 11 Nov 2010 03:01:56 +0530
changeset 481 a4056cec859e
parent 403 9858ca9e3f93
child 487 cb3974daced5
permissions -rw-r--r--
Internal Review not don for `getting starte with functions`

% Created 2010-11-07 Sun 18:57
\documentclass[presentation]{beamer}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{soul}
\usepackage{t1enc}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\usepackage[english]{babel} \usepackage{ae,aecompl}
\usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
\usepackage{listings}
\lstset{language=Python, basicstyle=\ttfamily\bfseries,
commentstyle=\color{red}\itshape, stringstyle=\color{red},
showstringspaces=false, keywordstyle=\color{blue}\bfseries}
\providecommand{\alert}[1]{\textbf{#1}}

\title{Testing and debugging}
\author{FOSSEE}
\date{}

\usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
\begin{document}

\maketitle









\begin{frame}
\frametitle{Outline}
\label{sec-1}

\begin{itemize}
\item What software Testing is?
\item Learn to test simple functions for their functionality.
\item Learn how to automate tests.
\item Need for coding style and some of the standards followed by the Python Community.
\item Handling Errors and Exceptions.
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{gcd function}
\label{sec-2}

\begin{itemize}
\item Create gcd.py file with:
\end{itemize}

\begin{lstlisting}[language=python]
  def gcd(a, b):
        if a % b == 0: 
            return b
        return gcd(b, a%b)
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Test for gcd.py}
\label{sec-3}

\begin{itemize}
\item Edit gcd.py file
\end{itemize}

\begin{lstlisting}[language=python]

  def gcd(a, b):
      if b == 0:
          return a
      return gcd(b, a%b)
  
  if __name__=='__main__':
      result = gcd(48, 64)
      if result != 16:
          print "Test failed"
      print "Test Passed"
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Automating tests}
\label{sec-4}

\begin{lstlisting}[language=python]

    if __name=__='__main__':
    for line in open('numbers.txt'):
        numbers = line.split()
        x = int(numbers[1])
        y = int(numbers[2])
        result = int(numbers[3])
        if gcd(x, y) != result:
            print "Failed gcd test
                          for", x, y
\end{lstlisting}




$^{1}$ FOOTNOTE DEFINITION NOT FOUND: 0

$^{2}$ FOOTNOTE DEFINITION NOT FOUND: 1

$^{3}$ FOOTNOTE DEFINITION NOT FOUND: 2
\end{frame}

\end{document}