CEN 5070 – Software V&V Automation for Program Testing © 2001-2008, E.L. Jones.

Slides:



Advertisements
Similar presentations
A Guide to Unix Using Linux Fourth Edition
Advertisements

CS 497C – Introduction to UNIX Lecture 22: - The Shell Chin-Chih Chang
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Linux+ Guide to Linux Certification, Second Edition
Shell Basics CS465 - Unix. Shell Basics Shells provide: –Command interpretation –Multiple commands on a single line –Expansion of wildcard filenames –Redirection.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
Scripting Languages and C-Shell. What is a scripting language ? Script is a sequence of commands written as plain text and run by an interpreter (shell).
CS 497C – Introduction to UNIX Lecture 23: - Simple Filters Chin-Chih Chang
Guide To UNIX Using Linux Third Edition
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Shell Scripting Awk (part1) Awk Programming Language standard unix language that is geared for text processing and creating formatted reports but it.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Advanced File Processing
Advanced Shell Programming. 2 Objectives Use techniques to ensure a script is employing the correct shell Set the default shell Configure Bash login and.
1 Operating Systems Lecture 3 Shell Scripts. 2 Shell Programming 1.Shell scripts must be marked as executable: chmod a+x myScript 2. Use # to start a.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Week 7 Working with the BASH Shell. Objectives  Redirect the input and output of a command  Identify and manipulate common shell environment variables.
Internet Forms and Database Bob Kisel Amgraf, Inc.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
Guide To UNIX Using Linux Fourth Edition
Unix Talk #2 (sed). 2 You have learned…  Regular expressions, grep, & egrep  grep & egrep are tools used to search for text in a file  AWK -- powerful.
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
From Use Cases to Test Cases 1. A Tester’s Perspective  Without use cases testers will approach the system to be tested as a “black box”. “What, exactly,
CIS 218 Advanced UNIX1 CIS 218 – Advanced UNIX (g)awk.
Testing Workflow In the Unified Process and Agile/Scrum processes.
Writing C-shell scripts #!/bin/csh # Author: Ken Berman # Date: # Purpose: display command and parameters echo $0 echo $argv[*]
Shell Script Programming. 2 Using UNIX Shell Scripts Unlike high-level language programs, shell scripts do not have to be converted into machine language.
Additional UNIX Commands. 222 Lecture Overview  Multiple commands and job control  More useful UNIX utilities.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
1 Shell Scripting (C shell) SungHo Maeung 10/27/2000 Tutorial section Computer Science Lab.
Lecture 4  C Shell Scripts(Chapter 10). Shell script/program  Shell script: a series of shell commands placed in an ASCII text file  Commands include.
Essential Shell Programming by Prof. Shylaja S S Head of the Dept. Dept. of Information Science & Engineering, P.E.S Institute of Technology, Bangalore
Linux+ Guide to Linux Certification, Third Edition
Linux Operations and Administration
Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 5.1 © Copyright IBM Corporation 2008 Unit 11: Shell.
Shell Programming Any command or a sequence of UNIX commands stored in a text file is called a shell program. It is common to call this file a command.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Chapter Five Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command.
Shell Programming. Introducing UNIX Shells  Shell is also a programming language and provides various features like variables, branching, looping and.
Linux+ Guide to Linux Certification Chapter Eight Working with the BASH Shell.
Agenda Regular Expressions (Appendix A in Text) –Definition / Purpose –Commands that Use Regular Expressions –Using Regular Expressions –Using the Replacement.
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
1 Operating Systems Lecture 2 UNIX and Shell Scripts.
Copyright © 2010 Certification Partners, LLC -- All Rights Reserved Perl Specialist.
Introduction to Unix – CS 21 Lecture 12. Lecture Overview A few more bash programming tricks The here document Trapping signals in bash cut and tr sed.
13 More Advanced Awk Mauro Jaskelioff (originally by Gail Hopkins)
Revision Lecture Mauro Jaskelioff. AWK Program Structure AWK programs consists of patterns and procedures Pattern_1 { Procedure_1} Pattern_2 { Procedure_2}
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Linux+ Guide to Linux Certification, Third Edition
©Colin Jamison 2004 Shell scripting in Linux Colin Jamison.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
CSCI 330 UNIX and Network Programming Unit IX: Shell Scripts.
Agenda Positional Parameters / Continued... Command Substitution Bourne Shell / Bash Shell / Korn Shell Mathematical Expressions Bourne Shell / Bash Shell.
1 P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Awk Programming Ruibin Bai (Room AB326) Division of Computer Science The University.
Linux+ Guide to Linux Certification, Second Edition
Searching CSE 103 Lecture 20 Wednesday, October 16, 2002 prepared by Doug Hogan.
NMD202 Web Scripting Week2. Web site
© Prepared By: Razif Razali 1 TMK 265: UNIX SYSTEM CHAPTER FOUR – QUOTING IN DETAIL.
CS 403: Programming Languages Lecture 20 Fall 2003 Department of Computer Science University of Alabama Joel Jones.
Chapter 15 Introductory Bourne Shell Programming.
1 UNIX Operating Systems II Part 2: Shell Scripting Instructor: Stan Isaacs.
Linux Administration Working with the BASH Shell.
CEN 5070 – Software V&V Automation for Unit Testing © , E.L. Jones.
CSE 303 Concepts and Tools for Software Development Richard C. Davis UW CSE – 10/9/2006 Lecture 6 – String Processing.
Agenda Control Flow Statements Purpose test statement
MATLAB: Structures and File I/O
Guide To UNIX Using Linux Third Edition
Unix Talk #2 (sed).
More advanced BASH usage
Introduction to Bash Programming, part 3
Presentation transcript:

CEN 5070 – Software V&V Automation for Program Testing © , E.L. Jones

October 2008Program Test Automation2 Purpose This lecture introduces design patterns to automate the testing of executable programs (or applications). The testing lifecycle phases involved are implementation, execution and evaluation.

October 2008Program Test Automation3 Agenda Revising the Test Script The Need for Shell Scripts Putting it All Together Invoking program under test Set-up: required files Insertion of stored test cases Capture and formatting of test results Test execution instructions Verification of test results

October 2008Program Test Automation4 Shell Scripts Shell scripts automate the use of operating system commands and utilities for program execution, and management of test data and results. We begin with the test environment.

October 2008Program Test Automation5 Application Test Environment Application Driver Test data Application Under Test Test History Index ‘thx_xxx.txt’ Verification Actual results Test results ‘utr_xxx.txt’ Test History Index ‘thx_xxx.txt’ Test Case Data ‘tdi_xxx.txt’ Test Script ‘uts_xxx.txt’ Test Log ‘utl_xxx.txt’

October 2008Program Test Automation6 0. Application Driver Specification Application Test Driver (1) tdi_ filename (2) thx_ filename (3) utr_ filename thx_ file utr_ file tdi_ file thx_ file Application.run file

October 2008Program Test Automation7 1. Automated Invocation of Interactive Application echo 5 4 |./Add.run echo “5 4” |./Add.run  Pipe inputs into stdin stream. Add.run reads inputs from stdin.  WARNING: Piping as a quoted string does not work properly.

October 2008Program Test Automation8 2. Automated Insertion of Stored Test Cases set testcase=(`cat tdi_Add.txt`) set num1=$testcase[1] set num2=$testcase[2] set expected=$testcase[3] echo $num1 $num2 |./Add.run shift testcase  Create list of all test cases in in file. A list is an array $testcase[1..$#testcase]  Extract test case into application specific variables.  Pipe first two stimui as input to stdin and invoke Add.run  Each shift command removes one (used) value from front of the list.

October 2008Program Test Automation9 3. Automated Capture of Execution Results set res = `echo $num1 $num2 |./Add.run` Set sum=`echo $res | awk ‘{print $5}’`  Variable $res contains application output (prompts and results).  Based on the FORMAT of output, “parse for” the results using awk.. Example: x=## y=## SUM = 14  The answer (sum) is the 5th token in the output.

October 2008Program Test tcnum++ echo –n “$runid $tcnum num1=$num1 num2=$num2 “ echo “SUM= ” >> utrFile NOTES:The $runid must be managed (see next slide). The name of the utr_ file is an argument. After the testcase data have been used, remove them in preparation for the next test case.  Create utr record showing stimuli and results. Record unique by testrun# and testcase#. 4. Store Formatted Test Result Record

October 2008Program Test Automation11 5. Set the Test Run# if (! –e thx_File) then #-| generate header lines. endif set runid=`tail -1 thxFile | awk –F# ‘{print $1}’` #-| The current runid is 1 +previous runid++  If the thx_ file does not exist, create the file with the required header lines. NOTE: The thx_ file name is the second argument.  the last line in the thx_ file contains the runid.

October 2008Program Test Automation12 6. Update Test History Index #-| Write runid to thx_ file. echo “#$runid $user `date`“ >> thx_File #-| Write runid to thx_ file. echo “#$runid $user `date`“ >> utr_File  Append a line to the thx_ file to record the fact that this test run is beginning.  Also append a line to the utr_ file to create a “section heading” for the results from the test run.

October 2008Program Test Automation13 7. Update Test Script SETUP Section TEST RUN Section B.Unit Execution C.Test Log Preparation D.Test Sequence  Include run_ shell script, test log, and the files used as inputs,  Modify to reflect automated steps.  Include invocation of run_ script.  Log is required if run_ script does not contain an oracle.  Remove individual test cases: these will now be read from the tdi_ file.

October 2008Program Test Automation14 7. Update Test Script (cont’d) CLOSE-OUT Section A.Test Log B.Test Documentation Files C.Saving Artifacts to Repository  This is the EVALUATION and ARCHIVAL activity.  Explain how to update test log from trs_ and thx_ files, if oracle not implemented. MUST describe each discrepancy and propose probable cause of defect.  Identify each artifact and how it is to be used/handled. Some may have to be modified.  All go to TS repository.file.

October 2008Program Test Automation15 8. Update Test Log Test Log MUST include: a) Verification Summary; b) Description of each defect/ hypothesis of root cause. c) Describe any “fixes” made to enable the test to be run again.  Count all defects (unexpected results/inability to perform steps)  Description should be specific and general (if a pattern is seen).  Hypothesis is an educated guess as to the root cause.  Program is wrong  Test case is wrong  Test automation is wrong  Fixes to test cases or various scripts are the responsibility of the tester.

October 2008Program Test Automation16 9. Implement Test Oracle #-| Case 1: One exected result. if ($res == $expected) then echo “ PASSED” >> utr_File else echo “ FAILED” >> utr_File endif echo –n “#$runid $user `date` “ >> utr_File echo “$passed PASSED $failed FAILED“ >> utr_File  Compare actual result to expected result, and append “PASSED” or “FAILED” to test record.  NOTE: Include COUNTERS for passes and failures. These can be included in FOOTER records in both utr_ and thx_ files.

October 2008Program Test Automation17 9. Implement Test Oracle (cont’d) #-| Case 2: Multiple expected #-| results (e.g. match1 = ($res1 == match2 = ($res2 == match3 = ($res3 == matched = $match1 + $match2 \ $match3 If ($matched == 3) then echo “ PASSED” >> utr_File else echo “ FAILED” >> utr_File endif  Note that the result from each comparison is 1 (true) or 0(false). ALL must be true to PASS.  NOTE: Include COUNTERS for passes and failures.

October 2008Program Test Automation18 Shell Scripts for Testing Programs -- Summary Unix provides a powerful set of primitive operating system and scripting facilities for automating the testing of programs. This lecture has shown that automation can be applied to support most of the SPRAE principles. The design patterns shown can be extended to programs of moderate complexity.