You are on page 1of 8

Midterm Examination ECSE429 / Fall 2013

Question 1 (25 marks)


Answer the following six short or multiple choice questions.

Question 1.1 (5 marks)


The problem with the following code excerpt is that the method actually returns values in a range
from -100 to 100 instead of 0 to 100 as stated in the comment.
/**
* Calculates a value in the range of 0 to 100 based on the alphabetical distance of the input String to A and Z,
* i.e., an input String A results in 0, while an input String Z results in 100.
*/
public static Integer calculateValueInRange(String input)

Is this problem an error, a bug, a fault, a failure, or a defect? Explain why or why not for each of
these terms.

Question 1.2 (4 marks)


In the space below, draw the V-Model of Development including software development phases, test
plans, and types of testing.

Page 2 of 9
Midterm Examination ECSE429 / Fall 2013

Question 1.3 (4 marks)


What is the difference between a sneak path and a trap door?

Question 1.4 (4 marks)


What is the difference between validation and verification?

Question 1.5 (4 marks)


Indicate which of the following statements are true or false? TRUE FALSE
a) A class method is best tested in isolation from other class methods.
b) A program is better tested by someone who did not write it.
c) Testing can prove software is free of defects.
d) Testing can start only after some code has been written.

Question 1.6 (4 marks)


Indicate by placing X in the appropriate cells
UNIT INTEGRATION SYSTEM
which of the following characteristics apply to
TESTING TESTING TESTING
unit, integration, or system testing?

a) from module specifications


b) no drivers/stubs
c) from requirements specifications
d) visibility of code details
e) interaction among modules
f) complex scaffolding

Page 3 of 9
Midterm Examination ECSE429 / Fall 2013

Question 2 (20 marks)


Use category partitioning to define test cases for the given problem specification.
Problem Specification
A program decides given a string S as input whether to start or stop a media player. The media player
is started, if the length of the string is equal to 4 and the string starts with the letter p. If the input
string starts with the letter p, then the input string may also specify the number of tracks to skip
forward from the current position before starting the media player. To skip forward, the second
letter of the input string must be f, followed by two digits indicating the number of tracks to skip
forward. For any other input string of length 4, the media player is stopped.

Part 1 (15 marks): Show your categories, choices, and constraints in a formal test specification.

Part 2 (5 marks): Derive test frames using the each choice criterion, i.e., each choice for each category
must be used at least in one test frame. Use the table below to report your test frames. Make sure
that one can clearly identify the choices in your test frames (e.g., by using unique IDs for the choices
in your formal test specification). You do not need to show actual test data.
Frame ID Choices

Page 4 of 9
Midterm Examination ECSE429 / Fall 2013

Question 3 (30 marks)


Part 1 (10 marks): Complete the cause effect graph for the problem specification given below. Note
that all four effects are explicitly identified in the problem specification, but not all causes. However,
you should not need any more causes than already shown in the cause effect graph.
Problem Specification
A new fare card for public transport is introduced in your favorite city. The city offers express transit
routes (c4) and regular transit routes (c3) to its customers. A customer can either load cash or
monthly transit passes onto the fare card, but not both at the same time. A customers fare card is
read when boarding a bus or entering the metro system. If the customer has chosen the monthly
pass option, the system accepts the fare card (e1) only if a pass for the current month is on the fare
card. Otherwise, the fare card is rejected (e2). Regular and express routes are treated the same when
using a monthly pass. If the customer has chosen the cash option, a sufficient amount of cash (c1) is
required on the fare card, otherwise the fare card is rejected. If the fare card is accepted for a cash
fare and the customer is traveling on a regular transit route, the regular fare is deducted (e3) from
the fare card. If the fare card is accepted for a cash fare and the customer is traveling on an express
transit route, the express fare is deducted (e4) from the fare card.

c1 e1

sufficient cash card accepted

c2 e2

card rejected
(fill in this missing cause)

c3 e3

regular route regular fare deducted


V i1

c4 e4

express route express fare deducted

Page 5 of 9
Midterm Examination ECSE429 / Fall 2013

Part 2 (4 marks): Derive a Boolean formula each for the effect card accepted and the effect card
rejected in the cause effect graph.

Part 3 (8 marks): From the Boolean formula for the effect card accepted only, derive a compact
decision table using the each-condition/all-condition approach. Use the table below for your
decision table.

c1 c2 c3 c4 result

Page 6 of 9
Midterm Examination ECSE429 / Fall 2013

Part 4 (8 marks): From the Boolean formula for the effect card rejected only, derive a list of test
cases that fulfill the modified condition/decision coverage criteria. In the provided table, show for
each test case the ID, the required input, the expected result, and which two test cases are paired
with each other as required by modified condition/decision coverage.

Test Input Expected Paired


ID c1 c2 c3 c4 Result With

Page 7 of 9
Midterm Examination ECSE429 / Fall 2013

Question 4 (15 marks)


Part 1 (10 marks): Draw the data flow graph for the given program.
1 public int calculateSomething(int n) {
2 int counter, result = 0;
3 if (n < 0)
4 result = -1;
5 for (counter=0; counter<n; counter++) {
6 result = result + counter;
7 }
8 return result;
9}

Part 2 (5 marks): List the paths for result that satisfy the all-uses data flow coverage criteria. State for
each path whether the path is feasible or not.

Page 8 of 9
Midterm Examination ECSE429 / Fall 2013

Question 5 (10 marks)


Part 1 (5 marks): Derive the round-trip path tree from the given state model.

S0
a/y
S1 S2
a[n>0]/x
b/x c/y
S4
a/y S3 d/z

a/x

Part 2 (5 marks): Generate all sneak path test cases for the given state model using the provided
table. The actual test data does not need to be specified.

Test
State Event Condition
ID

Page 9 of 9

You might also like