%\documentclass[handout]{beamer} \documentclass[t,12pt,numbers,fleqn]{beamer} %\documentclass[ignorenonframetext]{beamer} \newif\ifquestions %\questionstrue \questionsfalse \usepackage{pgfpages} \usepackage{hyperref} \hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, urlcolor=blue, unicode=false} \urlstyle{same} \usepackage{listings} \bibliographystyle{plain} %\usetheme{Iimenau} \useoutertheme{split} %so the footline can be seen, without needing pgfpages %\pgfpagesuselayout{resize to}[letterpaper,border shrink=5mm,landscape] %if this is uncommented, the hyperref links do not work \mode<presentation>{} \input{../def-beamer} \newcommand{\topic}{10 Verification and Validation Continued} \input{../titlepage} \begin{document} \input{../footline} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Verification and Validation Continued} \bi \item Administrative details \item Questions? \item Nonfunctional software testing \item Theoretical foundations of testing \item Complete coverage principle \item White box testing \item Oracle problem \item SCS Specific Ideas \item Overview of \href{https://github.com/smiths/capTemplate/tree/main/docs/VnVPlan} {template} \ei \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \input{../Deadlines.tex} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Administrative Details: Drasil Resources} \bi \item \href{http://learnyouahaskell.com/} {Learn you a Haskell for Great Good} \item \href{https://github.com/JacquesCarette/literate-scientific-software} {Drasil on GitHub} \item \href{https://macsphere.mcmaster.ca/handle/11375/25542} {Design Language for Code Variabilities in Chapter 6 of Brook's thesis} \item \href{https://jacquescarette.github.io/Drasil/} {Drasil Generated Examples} \item \href{https://jacquescarette.github.io/Drasil/docs/index.html} {Drasil Haddock Documentation} \item \href{https://jacquescarette.github.io/Drasil/} {Package Dependency Graph (at the bottom of the page)} \item \href{https://github.com/JacquesCarette/Drasil/wiki/Creating-Your-Project-in-Drasil} {Creating your project in Drasil} \item \href{https://github.com/JacquesCarette/Drasil/wiki} {Drasil Wiki} \ei \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Administrative Details Continued} \begin{itemize} \item \href{https://gitlab.cas.mcmaster.ca/smiths/cas741/-/commit/0bdea9edc7464bb57c2f3524bebfd4f3b59cdc80} {Some Domain Expert assignments have changed} \item Yasmin dropped the course, so Bo will need to find another project to evaluate \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Questions?} \begin{itemize} %\item Questions about SRS? \item Questions about V\&V? \item Questions about PoC? \item Other questions? \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Goals of Testing} \begin{itemize} \item \structure{If our code passes all test cases, is it now guaranteed to be error free?} \item \structure{Are 5000 random tests always better than 15 carefully selected tests?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Goals of Testing} \begin{itemize} \item To show the \structure{presence} of bugs (Dijkstra, 1972) \item If tests do not detect failures, we cannot conclude that software is defect-free \item Still, we need to do testing - driven by sound and systematic principles \begin{itemize} \item Random testing is often not a systematic principle to use % look at the example from the text, or divide by zero within a circular range \item Need a test plan \end{itemize} \item Should help isolate errors - to facilitate debugging \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Goals of Testing Continued} \begin{itemize} \item Should be repeatable \begin{itemize} \item Repeating the same experiment, we should get the same results \item Repeatability may not be true because of the effect of the execution environment on testing \item Repeatability may not occur if there are uninitialized variables \item Repeatability may not happen when there is nondeterminism \end{itemize} \item Should be accurate \begin{itemize} \item Accuracy increases reliability \item Part of the motivation for formal specification \end{itemize} \item \structure{Is a \structure{successful} test case one that passes the test, or one that shows a failure?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Test (V\&V) Plan} \begin{itemize} \item \structure{Given that no single verification technique can prove correctness, the practical approach is to use ALL verification techniques. Is this statement True or False?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Test (V\&V) Plan} \begin{itemize} \item Testing can uncover errors and build confidence in the software \item Resources of time, people, facilities are limited \item Need to plan how the software will be tested \item You know in advance that the software is unlikely to be perfect \item You need to put resources into the most important parts of the project \item A risk analysis can determine where to put your limited resources \item A risk is a condition that can result in a loss \item Risk analysis involves looking at how bad the loss can be and at the probability of the loss occurring \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Description Rather Than Specification} \begin{itemize} \item Test cases are often phrased as Expected = Calculated \item In scientific software you generally should not test for equality \bi \item Absolute error within tolerance \item Relative error within tolerance \item If comparing matrices or vectors, consider using norms of residual \ei \item Even a specific tolerance often doesn't make sense in a scientific context \item Often your plan should be to \textbf{describe} the error rather than \textbf{prescribe} \bi \item Plot of error versus problem size, or condition number, or ... \item Consider summarizing multiple tests with the infinity norm of the relative error (or similar) \ei \item Your description plan is part of your V\&V plan! \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{White Box Versus Black Box Testing} \begin{itemize} \item \structure{Do you know (or can you guess) the difference between white box and black box testing?} \item \structure{What if they were labelled transparent box and opaque box testing, respectively?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{White Box Versus Black Box Testing} \begin{itemize} \item White box testing is derived from the program's internal structure \item Black box testing is derived from a description of the program's function \item Should perform both white box and black box testing \item Black box testing \begin{itemize} \item Uncovers errors that occur in implementing requirements or design specifications \item Not concerned with how processing occurs, but with the results \item Focuses on functional requirements for the system \item Focuses on normal behaviour of the system \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{White Box Testing} \begin{itemize} \item Uncovers errors that occur during implementation of the program \item Concerned with how processing occurs \item Evaluates whether the structure is sound %\item Focuses on the nonfunctional requirements for the system \item Focuses on abnormal or extreme behaviour of the system \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Dynamic Testing} \begin{itemize} \item \structure{Is there a dynamic testing technique that can guarantee correctness?} \item \structure{If so, what is the technique?} \item \structure{Is this technique practical?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Dynamic Versus Static Testing} \begin{itemize} \item Another classification of verification techniques, as previously discussed \item Use a combination of dynamic and static testing \item Dynamic analysis \begin{itemize} \item Requires the program to be executed \item Test cases are run and results are checked against expected behaviour \item Exhaustive testing is the only dynamic technique that guarantees program validity \item Exhaustive testing is usually impractical or impossible \item Reduce number of test cases by finding criteria for choosing representative test cases \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Static Testing Continued} \begin{itemize} \item Static analysis \begin{itemize} \item Does not involve program execution \item Testing techniques simulate the dynamic environment \item Includes syntax checking \item Generally static testing is used in the requirements and design stage, where there is no code to execute \item Document and code walkthroughs (including \href{https://en.wikipedia.org/wiki/Rubber_duck_debugging} {rubber duck debugging}) \item Document and code inspections \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Manual Versus Automated Testing} \begin{itemize} \item \structure{What is the difference between manual and automated testing?} \item \structure{What are the advantages of automated testing?} \item \structure{What is regression testing?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Manual Versus Automated Testing} \begin{itemize} \item Manual testing \begin{itemize} \item Has to be conducted by people \item Includes by-hand test cases, structured walkthroughs, code inspections \end{itemize} \item Automated testing \begin{itemize} \item The more automated the development process, the easier to automate testing \item Less reliance on people \item Necessary for \structure{regression testing} \item Test tools can assist, such as Junit, Cppunit, CuTest etc. \item Can be challenging to automate GUI tests \item Test suite for Maple has 2 000 000 test cases, run on 14 platforms, every night, automated reporting \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \begin{frame} % \frametitle{Automated Testing at MapleSoft} % \begin{itemize} % \item Three steps % \begin{itemize} % \item Write the problem description % \item result := solver(problem) % \item assert(result == expected) % \end{itemize} % \item Assert writes out code to reproduce any failures % \item Track failures % \begin{itemize} % \item Source code management (like CVS or Subversion) % \item Database of test cases, functions called % \item Database of source files, functions defined % \item Database of 40 days of timings and resources used % \end{itemize} % \item Automatically sends an e-mail to the programmer and his/her boss % \end{itemize} % \end{frame} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Continuous Integration Testing} \begin{itemize} \item \structure{What is continuous integration testing?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Continuous Integration Testing} \begin{itemize} \item Building and testing software on every push (see \href{https://martinfowler.com/articles/continuousIntegration.html} {Fowler}) \item Information available on \href{https://en.wikipedia.org/wiki/Continuous_integration}{Wikipedia} \item Developers frequently integrate code into a shared repo \item Each integration is automatically accompanied by regression tests and other build tasks \item Build server \bi \item Unit tests \item Integration tests \item Static analysis \item Profile performance \item Extract documentation \item Update project web-page \item Portability tests \item etc. \ei \item Avoids potentially extreme problems with integration when the baseline and a developer's code greatly differ \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Continuous Integration Tools} \begin{itemize} \item Gitlab % \bi % \item Example at % \href{https://gitlab.cas.mcmaster.ca/andrem5/RogueReborn/pipelines}{Rogue % Reborn} % \ei \item Jenkins \item Travis \item \href{https://mcmasteru365.sharepoint.com/:v:/r/sites/course-555318-group/Shared\%20Documents/General/Tutorials/Tutorial\%202_\%20CI_CD-20220919_143225-Meeting\%20Recording.mp4?csf=1&web=1&e=obymWH&nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJTdHJlYW1XZWJBcHAiLCJyZWZlcnJhbFZpZXciOiJTaGFyZURpYWxvZy1MaW5rIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXcifX0\%3D} {Shared Team's Video on Continuous Integration} with \href{https://gitlab.cas.mcmaster.ca/courses/capstone/-/tree/main/Tutorials/T02_CICD?ref_type=heads} {extra material} \item \href{https://www.docker.com/}{Docker} \bi \item Eliminates the ``it works on my machine'' problem \item Package dependencies with your apps \item A container for lightweight virtualization \item Not a full VM \ei \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Sample Nonfunctional System Testing} \begin{itemize} \item Stress testing --- Determines if the system can function when subject to large volumes \item Usability testing \item Performance measurement \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Sample Functional System Testing} \begin{itemize} % \item Requirements: Determines if the system can perform its function correctly and that the correctness can be % sustained over a continuous period of time % %\item Regression: Determines if changes to the system do not invalidate previous positive testing results % \item Error Handling: Determines the ability of the system to properly process % incorrect transactions % \item Manual Support: Determines that the manual support procedures are documented and complete, where manual support % involves procedures, interfaces between people and the system, and training procedures \item Parallel: Determines the results of the new application are consistent with the processing of the previous application or version of the application \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Theoretical Foundations Of Testing: Definitions} \begin{itemize} \item P (program), D (input domain), R (output domain) \bi \item P: D $\rightarrow$ R (may be partial) \ei \item Correctness defined by OR $\subseteq$ D $\times$ R \bi \item P(d) correct if $\langle$ d, P(d) $\rangle \in$ OR \item P correct if all P(d) are correct \ei \item Failure \bi \item P(d) is not correct \item May be undefined (error state) or may be the wrong result \ei \item Error (Defect) \bi \item Anything that may cause a failure \bi \item Typing mistake \item Programmer forgot to test ``x=0'' \ei \ei \item Fault \bi \item Incorrect intermediate state entered by program \ei \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Definitions Questions} \begin{itemize} \item \structure{A test case t is an element of D or R?} \item \structure{A test set T is a finite subset of D or R?} \item \structure{How would we define whether a test is successful?} \item \structure{How would we define whether a test set is successful?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Definitions Continued} \begin{itemize} \item Test case t: An element of D \item Test set T: A finite subset of D \item Test is successful if P(t) is correct \item Test set successful if P correct for all t in T \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Theoretical Foundations of Testing} \begin{itemize} \item Desire a test set $T$ that is a finite subset of $D$ that will uncover all errors \item Determining and ideal $T$ leads to several \href{https://en.wikipedia.org/wiki/Undecidable_problem}{undecideable problems} \item No algorithm exists: \bi \item To state if a test set will uncover all possible errors \item To derive a test set that would prove program correctness \item To determine whether suitable input exists to guarantee execution of a given statement in a given program \item etc. \ei \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Empirical Testing} \begin{itemize} \item Need to introduce empirical testing principles and heuristics as a compromise between the impossible and the inadequate \item Find a strategy to select \structure{significant} test cases \item Significant means the test cases have a high potential of uncovering the presence of errors \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Complete-Coverage Principle} \begin{itemize} \item Try to group elements of $D$ into subdomains $D_1$, $D_2$, ..., $D_n$ where any element of each $D_i$ is likely to have similar behaviour \item $D = D_1 \cup D_2 \cup ... \cup D_n$ \item Select one test as a representative of the subdomain \item If $D_j \cap D_k = \emptyset$ for all $j \neq k$, (partition), any element can be chosen from each subdomain \item Otherwise choose representatives to minimize number of tests, yet fulfilling the principle \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Complete-Coverage Principle} \includegraphics[scale=0.5]{../Figures/CompleteCoveragePrinciple.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{White-box Testing} \begin{itemize} \item \structure{Intuitively, after running your test suites, what percentage of the lines of code in your program should be exercised?} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{White-box Coverage Testing} \begin{itemize} \item (In)adequacy criteria - if significant parts of the program structure are not tested, testing is inadequate \item Control flow coverage criteria \begin{itemize} \item Statement coverage \item Edge coverage \item Condition coverage \item Path coverage \end{itemize} \end{itemize} Examples that follow are from \cite{GhezziEtAl2003} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Statement-Coverage Criterion} \begin{itemize} \item Select a test set $T$ such that every elementary statement in $P$ is executed at least once by some $d$ in $T$ \item An input datum executes many statements - try to minimize the number of test cases still preserving the desired coverage \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Example} \includegraphics[scale=0.5]{../Figures/ExampleStatementCoverageOnlyCode.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Example} \includegraphics[scale=0.5]{../Figures/ExampleStatementCoverage.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Weakness of the Criterion} \includegraphics[scale=0.6]{../Figures/WeaknessStatementCoverageOnlyCode.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Weakness of the Criterion} \includegraphics[scale=0.6]{../Figures/WeaknessStatementCoverage.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Edge-Coverage Criterion} \begin{itemize} \item Select a test set $T$ such that every edge (branch) of the control flow is exercised at least once by some $d$ in $T$ \item This requires formalizing the concept of the control graph and how to construct it \begin{itemize} \item Edges represent statements \item Nodes at the ends of an edge represent entry into the statement and exit \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Control Graph Construction Rules} \includegraphics[scale=0.4]{../Figures/ControlGraphRules.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Simplification} A sequence of edges can be collapsed into just one edge\\ ~\newline \includegraphics[scale=0.5]{../Figures/Simplification.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Example: Euclid's Algorithm} \includegraphics[scale=0.5]{../Figures/EuclidsAlgorithmNoGraph.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Example: Euclid's Algorithm} \includegraphics[scale=0.5]{../Figures/EuclidsAlgorithm.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Weakness} \includegraphics[scale=0.4]{../Figures/WeaknessEdgeCoverage.png}\\ \uncover<2->{\structure{Do not discover the error ($<$ instead of $\leq$)}} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} %\frametitle{Alternative View of Condition Coverage} \lstset{language=java,breaklines=true,showspaces=false,showstringspaces=false,breakatwhitespace=true} \noindent \lstinputlisting{CondCovExample.java} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Condition-Coverage Criterion} \begin{itemize} \item Select a test set $T$ such that every edge of $P$'s control flow is traversed and all possible values of the constituents of compound conditions are exercised at least once \item This criterion is finer than edge coverage \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Weakness} \includegraphics[scale=0.5]{../Figures/WeaknessConditionCoverage.png} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Path-Coverage Criterion} \begin{itemize} \item Select a test set $T$ that traverses all paths from the initial to the final node of $P$s control flow \item It is finer than the previous kinds of coverage \item However, number of paths may be too large, or even infinite (see while loops) \item Loops \begin{itemize} \item Zero times (or minimum number of times) \item Maximum times \item Average number of times \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{The Infeasibility Problem} \begin{itemize} \item Syntactically indicated behaviours (statements, edges, etc.) are often impossible \item Unreachable code, infeasible edges, paths, etc. \item Adequacy criteria may be impossible to satisfy \begin{itemize} \item Manual justification for omitting each impossible test case \item Adequacy ``scores'' based on coverage - example 95 \% statement coverage \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Further Problem} \begin{itemize} \item What if the code omits the implementation of some part of the specification? \item White box test cases derived from the code will ignore that part of the specification! \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Testing Boundary Conditions} \begin{itemize} \item Testing criteria partition input domain in classes, assuming that behavior is ``similar'' for all data within a class \item Some typical programming errors, however, just happen to be at the boundary between different classes \begin{itemize} \item Off by one errors \item $<$ instead of $\leq$ \item equals zero \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Criterion} \begin{itemize} \item After partitioning the input domain D into several classes, test the program using input values not only ``inside'' the classes, but also at their boundaries \item This applies to both white-box and black-box techniques \item In practice, use the different testing criteria in combinations \item Use testing tools for coverage metrics \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{The Oracle Problem} \structure{When might it be difficult to know the ``expected'' output/behaviour?} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{The Oracle Problem} \begin{itemize} \item Given input test cases that cover the domain, what are the expected outputs? \item Oracles are required at each stage of testing to tell us what the right answer is \item Black-box criteria are better than white-box for building test oracles \item Automated test oracles are required for running large amounts of tests \item Oracles are difficult to design - no universal recipe \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{The Oracle Problem Continued} \begin{itemize} \item Determining what the right answer should be is not always easy \begin{itemize} %\item Air traffic control system \item Scientific computing \item Machine learning \item Artifical intelligence \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{The Oracle Problem Continued} \structure{What are some strategies we can use when we do not have a test oracle?} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Strategies Without An Oracle} \begin{itemize} \item Using an independent program to approximate the oracle (pseudo oracle) \item Method of manufactured solutions \item Properties of the expected values can be easier than stating the expected output \bi \item \uncover<1->{\structure<1>{Examples?}} \item \uncover<2->{List is sorted} \item \uncover<2->{Number of entries in file matches number of inputs} \item \uncover<2->{Conservation of energy or mass} \item \uncover<2->{Expected trends in output are observed (metamorphic testing \cite{Kanewala2015, KanewalaAndBieman2013, KanewalaAndLundgren2016})} \item \uncover<2->{etc.} \ei \item Properties of Correct Solution Section in SRS \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Metamorphic Testing} \bi \item Used for testing when there is no test oracle \item Test program has properties known as Metamorphic Relations (MR) \item MRs specify how a change in inputs should change the output \item For instance (KanewalaEtAl2014) \bi \item Finding the maximum of a list should be the same no matter the permutation of the list \item The average of a set of numbers will increase if each number added is larger than all previous numbers added \item Etc. \ei \item Metamorphic testing gets its name because new test cases are evolved from the old ones (ChenEtAl1998) \ei \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \begin{frame} % \frametitle{Analysis of Units} % \begin{itemize} % \item Dynamic testing of units is not the only option % \item Static testing (analysis) includes the following % \begin{itemize} % \item Informal inspection % \item Systematic inspection % \item Code walkthroughs, data flow analysis % \item Correctness proofs (for instance using pre and post conditions) % \item Complexity measures % \end{itemize} % \end{itemize} % \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Challenges Specific to Scientific Computing} \begin{itemize} \item Unknown solution \item Approximation of real numbers \item Nonfunctional requirements \item Parallel computation \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Mutation Testing for SC} \begin{itemize} \item Generate changes to the source code, called mutants, which become code faults \item Mutants include changing an operation, modifying constants, changing the order of execution, etc. \item The adequacy of a set of tests is established by running the tests on all generated mutants \item Need to account for floating point approximations \item See \cite{HookAndKelly2009} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Model Checking} \begin{itemize} \item Correctness verification, in general, is an undecidable problem \item Model checking is a recent verification technique based on the fact that most interesting system properties become decidable (algorithmically verifiable) when the system is modelled as a finite state machine \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Informal Analysis Techniques: Code Walkthrough} \begin{itemize} \item Code walkthroughs are a more rigorous version of \href{https://en.wikipedia.org/wiki/Rubber_duck_debugging} {Rubber Duck Debugging} \item Recommended prescriptions \begin{itemize} \item Small number of people (three to five) \item Participants receive written documentation from the designer a few days before the meeting \item Predefined duration of the meeting (a few hours) \item Focus on the \structure{discovery} of errors, not on fixing them \item Participants: designer, moderator, and a secretary \item Foster cooperation; no evaluation of people \item Experience shows that most errors are discovered by the designer during the presentation, while trying to explain the design to other people % like reading report out loud at NSF panel \end{itemize} \item Forces looking at the code from a different viewpoint \item Can be used for documentation too \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Informal Analysis Techniques: Code Inspection} \begin{itemize} \item A reading technique aiming at error discovery \item Based on checklists \begin{itemize} \item Use of uninitialized variables \item Jumps into loops \item Nonterminating loops \item Array indexes out of bounds \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Specific SC V\&V Approaches} Summary of most points below in \cite{Smith2016} \begin{itemize} \item Compare to closed-form solutions \item Method of manufactured solutions \cite{Roache1998} \item Interval arithmetic \cite{Hickey2001} \item Convergence studies \item Compare to other program (parallel testing) \item Can also consider using code inspection \bi \item \cite{KellyAndShepard2000, ShepardAndKelly2001} \item \href{https://www.evoketechnologies.com/code-review-checklist-perform-effective-code-reviews/}{Sample checklists} \ei \item \href{https://gitlab.cas.mcmaster.ca/SEforSC/se4sc/-/blob/git-svn/GradStudents/Cynthia/M.EngReport/Thesis_Main.pdf?ref_type=heads} {Cynthia Liu's SC Requirements Validation Techniques} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Specific SC V\&V NonFunctional} \begin{itemize} \item Installability, consider VMs \item Portability, consider VMs, Docker, CI \item Describe (rather than specify) impact of changing inputs \bi \item Accuracy \item Performance \item Relative comparison \ei \item Usability \bi \item \href{https://measuringu.com/sus/}{Fairly simple standard survey} %\item \href{https://gitlab.cas.mcmaster.ca/andrem5/RogueReborn/blob/master/Doc/TestPlan/TestPlan.pdf}{Example} \ei \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Validation Testing Report for PMGT} \begin{itemize} \item Prepared by Wen Yu (\href{https://gitlab.cas.mcmaster.ca/smiths/cas741/blob/master/Examples/MeshGenToolbox/doc/testingApp.pdf}{here}) \item Do not know the correct solution, but know properties of the correct solution \item Automated correctness validation tests \begin{itemize} \item The area of each element is greater than zero \item The boundary of the mesh is closed \item Vertices in a clockwise order \item $nc + nv - ne = 1$ \item ... \end{itemize} \item Visual correctness verification tests \begin{itemize} \item No vertex outside the input domain \item No vertex inside a cell \item No dangling edges \item All cells connected \item The mesh is conformal \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Validation Testing Report for PMGT (Continued)} \begin{itemize} \item List and description of test cases \item Test cases are labelled and numbered \item Traceability to SRS requirements \item Traceability to MG \item Summary of results \item Analysis of results \begin{itemize} \item Focus on nonfunctional requirements \item Speed \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Other VnV Plan Examples} \begin{itemize} \item \href{https://github.com/smiths/swhs/blob/master/docs/VnVPlan/PCM_VVPlan.pdf} {SWHS} \item \href{https://github.com/DeeshaPatel/CAS-741-Solar-Cooker} {Solar Cooker} \item \href{https://github.com/machadotiagom/CAS_741_Project} {3D Image Reconstruction in Medical Ultrasound} \item \href{https://github.com/icbicket/SpectrumImageAnalysisPy} {Spectrum Image Analysis} \item \href{https://github.com/palmerst/cas741_sp} {Chemical Speciation} \item \href{https://gitlab.cas.mcmaster.ca/smiths/cas741/-/tree/master/Examples?ref_type=heads} {Examples folder} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame} \frametitle{Test Plan From BlankProjectTemplate} \begin{itemize} \item \href{https://github.com/smiths/capTemplate/tree/main/docs/VnVPlan} {VnV template} \item For Unit VnV plan mention tools \begin{itemize} \item Linters \item Coding standard checkers (like flake8) \item unit testing frameworks \item Performance testing (like Valgrind) \end{itemize} \end{itemize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}[allowframebreaks] \frametitle{References} \bibliography{../../ReferenceMaterial/References} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{document}