CSCI 265: Fall Final Exam
Sections F17N01-F17N02 (Dr. Wessels)

Question Mark
1. Bash scripting and git
[10 marks]
 
2. Perl scripting and modules
[10 marks]
 
3. Test case design
[10 marks]
 
4. Makefiles
[10 marks]
 
5. Test automation in Perl
[10 marks]
 
6. Code standards and inspections
[10 marks]
 
7. Debugging and design
[10 marks]
 
8. Defect reporting
[10 marks]
 
9. Life cycle models and testing
[10 marks]
 
Exam Total

[80 marks]

 

Question 1: Bash scripting and git [10]

Write a bash script to do the following when run in the root of a git repository:

Notes:
The following command lists all the git commit ids in the current repository, one per line, with the most recent at the top:
git log --pretty=format:"%h"

The following command removes all but the first K lines of input in a file:
head -n K

The following command displays all the files associated with a git commit id:
git diff-tree --no-commit-id --name-only -r COMMITID

Question 1 cont.

Question 2: Perl scripting and modules [10]

Write a perl module (using package name "myfiles") that implements and exports function extls, which has the following behaviour:

Hint: one approach is to use split to get the file extension, and build a hash table whose keys are the extensions and whose values are lists of the files with that extension.

Question 2 cont.

Question 3: Test case design [10]

Design a set of test cases for the basic functionality of grep in bash, i.e.
    grep pattern filename(s)
where the pattern is a bash-suitable regular expression and the filename(s) can include wildcards * and ?.

The correct behaviour for grep is to display each line of each file that matches the pattern, along with the name of the file itself. E.g. grep 'const' *.cpp might produce output like the following:

bracketCheck.cpp:const long MaxNesting = 128;
bracketCheck.cpp:const int NameLen = 32;
overloading_examples.C:      mydata operator=(const mydata x)
(Note that grep should display nothing if no files match the filename(s).)

For each test case, describe the test data to be used, the expected results, and the unique purpose of that particular test case.

Question 3 cont.

Question 4: Makefiles [10]

Makefiles are intended to automate handling of dependencies and commands.
Usually this is applied in the context of compilation, but it can be used more broadly.

You are to create a makefile that uses targets, dependencies, and rules appropriately to automate the code testing process described below.

Overview: the team project code is divided into two core directories - a development directory and an official testing directory. Each of these has the following subdirectories:

Formal testing is carried out in the official testing directory, and follows the rules below:

The table below summarizes the variables and default values to be used by the makefile.

# specify the base directories for testing and development
TestDir=/home/testing/
DevDir=/home/development/

# specify the subdirectories for data, expected results, actual results, code, and bin
DataSub=data/
ExpectedSub=expected/
ResultsSub=results/
CodeSub=code/
BinSub=bin/

# specify the names of the test driver script and program under test
Driver=driver.pl
Program=progx

Some relevant linux commands and options may include
rm -f filename; rm -rf dirname; cp -f oldfile newfile; cp -rf original newdir; mkdir -p dirname;

Question 4 cont.

Question 5: Test automation in Perl [10]

Write a perl script using the Test::More module to apply/evaluate the following tests of the bash "cd" command's functionality (output, return value, side effects):

current dircommand new directory exit status output
/ cd $HOME 0 None
$HOME cd / / 0 None
$HOME/foo/blah cd .. $HOME/foo 0 None
$HOME/foo cd . $HOME/foo 0 None
$HOME cd LOCKED $HOME >0 Permission denied
$HOME cd NONEXIST $HOME >0 No such file or directory
Notes: LOCKED indicates a directory for which the user does not have execute permission
NONEXIST indicates a non-existent directory
$HOME indicates the user's home directory as defined by the environment variable
/ indicates the system root directory
other path names are assumed to indicate valid existing paths
>0 indicates an integer value greater than 0
Reminders: if you "use Cwd;" then the function getcwd will return the current directory, and chdir "dirname" changes the current working directory.

Question 5 cont.

Question 6: Code standards and inspections [10]

Suppose your team has just decided to make significant changes to their code standards for a large project.

Outline a process to carry out the revision, inspection, and testing of the team's code to bring it in line with the new standards. Be sure to clearly justify the decisions you have made, and identify any potential problems that may result from those decisions.

Question 6 cont.

Question 7: Debugging and design [10]

Discuss the relationship between the ease/difficulty of debugging software and the levels of cohesion and coupling within that software.

Question 7 cont.

Question 8: Defect reporting [10]

Suppose you were designing a web form to be used for reporting defects in VIU web pages. What are the four most critical fields you would include? Justify your choices.

Question 8 cont.

Question 9: Life cycle models and testing [10]

Provide arguments both for and against the following claim:

Question 9 cont.