testing-debugging/slides.tex
changeset 403 9858ca9e3f93
parent 401 abf092be95ef
child 487 cb3974daced5
equal deleted inserted replaced
402:9bf3411b264d 403:9858ca9e3f93
     1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1 % Created 2010-11-07 Sun 18:57
     2 %Tutorial slides on Python.
     2 \documentclass[presentation]{beamer}
     3 %
     3 \usepackage[latin1]{inputenc}
     4 % Author: FOSSEE 
     4 \usepackage[T1]{fontenc}
     5 % Copyright (c) 2009, FOSSEE, IIT Bombay
     5 \usepackage{fixltx2e}
     6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     6 \usepackage{graphicx}
       
     7 \usepackage{longtable}
       
     8 \usepackage{float}
       
     9 \usepackage{wrapfig}
       
    10 \usepackage{soul}
       
    11 \usepackage{t1enc}
       
    12 \usepackage{textcomp}
       
    13 \usepackage{marvosym}
       
    14 \usepackage{wasysym}
       
    15 \usepackage{latexsym}
       
    16 \usepackage{amssymb}
       
    17 \usepackage{hyperref}
       
    18 \tolerance=1000
       
    19 \usepackage[english]{babel} \usepackage{ae,aecompl}
       
    20 \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
       
    21 \usepackage{listings}
       
    22 \lstset{language=Python, basicstyle=\ttfamily\bfseries,
       
    23 commentstyle=\color{red}\itshape, stringstyle=\color{red},
       
    24 showstringspaces=false, keywordstyle=\color{blue}\bfseries}
       
    25 \providecommand{\alert}[1]{\textbf{#1}}
     7 
    26 
     8 \documentclass[14pt,compress]{beamer}
    27 \title{Testing and debugging}
     9 %\documentclass[draft]{beamer}
    28 \author{FOSSEE}
    10 %\documentclass[compress,handout]{beamer}
       
    11 %\usepackage{pgfpages} 
       
    12 %\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
       
    13 
       
    14 % Modified from: generic-ornate-15min-45min.de.tex
       
    15 \mode<presentation>
       
    16 {
       
    17   \usetheme{Warsaw}
       
    18   \useoutertheme{infolines}
       
    19   \setbeamercovered{transparent}
       
    20 }
       
    21 
       
    22 \usepackage[english]{babel}
       
    23 \usepackage[latin1]{inputenc}
       
    24 %\usepackage{times}
       
    25 \usepackage[T1]{fontenc}
       
    26 
       
    27 \usepackage{ae,aecompl}
       
    28 \usepackage{mathpazo,courier,euler}
       
    29 \usepackage[scaled=.95]{helvet}
       
    30 
       
    31 \definecolor{darkgreen}{rgb}{0,0.5,0}
       
    32 
       
    33 \usepackage{listings}
       
    34 \lstset{language=Python,
       
    35     basicstyle=\ttfamily\bfseries,
       
    36     commentstyle=\color{red}\itshape,
       
    37   stringstyle=\color{darkgreen},
       
    38   showstringspaces=false,
       
    39   keywordstyle=\color{blue}\bfseries}
       
    40 
       
    41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    42 % Macros
       
    43 \setbeamercolor{emphbar}{bg=blue!20, fg=black}
       
    44 \newcommand{\emphbar}[1]
       
    45 {\begin{beamercolorbox}[rounded=true]{emphbar} 
       
    46       {#1}
       
    47  \end{beamercolorbox}
       
    48 }
       
    49 \newcounter{time}
       
    50 \setcounter{time}{0}
       
    51 \newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
       
    52 
       
    53 \newcommand{\typ}[1]{\lstinline{#1}}
       
    54 
       
    55 \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
       
    56 
       
    57 % Title page
       
    58 \title{Your Title Here}
       
    59 
       
    60 \author[FOSSEE] {FOSSEE}
       
    61 
       
    62 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
       
    63 \date{}
    29 \date{}
    64 
    30 
    65 % DOCUMENT STARTS
    31 \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
    66 \begin{document}
    32 \begin{document}
    67 
    33 
    68 \begin{frame}
    34 \maketitle
    69   \maketitle
       
    70 \end{frame}
       
    71 
    35 
    72 \begin{frame}[fragile]
       
    73   \frametitle{Outline}
       
    74   \begin{itemize}
       
    75     \item 
       
    76   \end{itemize}
       
    77 \end{frame}
       
    78 
    36 
    79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    80 %%              All other slides here.                  %%
       
    81 %% The same slides will be used in a classroom setting. %% 
       
    82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       
    83 
    37 
    84 \begin{frame}[fragile]
    38 
    85   \frametitle{Summary}
    39 
    86   \begin{itemize}
    40 
    87     \item 
    41 
    88   \end{itemize}
    42 
    89 \end{frame}
       
    90 
    43 
    91 \begin{frame}
    44 \begin{frame}
    92   \frametitle{Thank you!}  
    45 \frametitle{Outline}
    93   \begin{block}{}
    46 \label{sec-1}
    94   \begin{center}
    47 
    95   This spoken tutorial has been produced by the
    48 \begin{itemize}
    96   \textcolor{blue}{FOSSEE} team, which is funded by the 
    49 \item What software Testing is?
    97   \end{center}
    50 \item Learn to test simple functions for their functionality.
    98   \begin{center}
    51 \item Learn how to automate tests.
    99     \textcolor{blue}{National Mission on Education through \\
    52 \item Need for coding style and some of the standards followed by the Python Community.
   100       Information \& Communication Technology \\ 
    53 \item Handling Errors and Exceptions.
   101       MHRD, Govt. of India}.
    54 \end{itemize}
   102   \end{center}  
    55 \end{frame}
   103   \end{block}
    56 \begin{frame}[fragile]
       
    57 \frametitle{gcd function}
       
    58 \label{sec-2}
       
    59 
       
    60 \begin{itemize}
       
    61 \item Create gcd.py file with:
       
    62 \end{itemize}
       
    63 
       
    64 \begin{lstlisting}[language=python]
       
    65   def gcd(a, b):
       
    66         if a % b == 0: 
       
    67             return b
       
    68         return gcd(b, a%b)
       
    69 \end{lstlisting}
       
    70 \end{frame}
       
    71 \begin{frame}[fragile]
       
    72 \frametitle{Test for gcd.py}
       
    73 \label{sec-3}
       
    74 
       
    75 \begin{itemize}
       
    76 \item Edit gcd.py file
       
    77 \end{itemize}
       
    78 
       
    79 \begin{lstlisting}[language=python]
       
    80 
       
    81   def gcd(a, b):
       
    82       if b == 0:
       
    83           return a
       
    84       return gcd(b, a%b)
       
    85   
       
    86   if __name__=='__main__':
       
    87       result = gcd(48, 64)
       
    88       if result != 16:
       
    89           print "Test failed"
       
    90       print "Test Passed"
       
    91 \end{lstlisting}
       
    92 \end{frame}
       
    93 \begin{frame}[fragile]
       
    94 \frametitle{Automating tests}
       
    95 \label{sec-4}
       
    96 
       
    97 \begin{lstlisting}[language=python]
       
    98 
       
    99     if __name=__='__main__':
       
   100     for line in open('numbers.txt'):
       
   101         numbers = line.split()
       
   102         x = int(numbers[1])
       
   103         y = int(numbers[2])
       
   104         result = int(numbers[3])
       
   105         if gcd(x, y) != result:
       
   106             print "Failed gcd test
       
   107                           for", x, y
       
   108 \end{lstlisting}
       
   109 
       
   110 
       
   111 
       
   112 
       
   113 $^{1}$ FOOTNOTE DEFINITION NOT FOUND: 0
       
   114 
       
   115 $^{2}$ FOOTNOTE DEFINITION NOT FOUND: 1
       
   116 
       
   117 $^{3}$ FOOTNOTE DEFINITION NOT FOUND: 2
   104 \end{frame}
   118 \end{frame}
   105 
   119 
   106 \end{document}
   120 \end{document}