unit 3 - navodaya institute of technology, web viewsystem specification, writes a series of formal...

26
UNIT 3 May/June 2010 1) Explain the following Equivalence Partitioning:- Sol:- Equivalence partitioning is a software testing technique that divides the input data of a software unit into partition of data from which test cases can be derived. In principle, test cases are designed to cover each partition at least once. This technique tries to define test case that uncovers classes of errors, thereby reducing the total number of test cases that must be developed. ii) Boundary Value Analysis:- Boundary value analysis is software testing design technique in which tests are designed to include representatives of boundary values. Values on the edge of an equivalence partition or at the smallest value on either side of an edge are taken for testing. The values could be either input or output ranges of a software component. Since these boundaries are common locations for errors that result in software faults they are frequently exercised in test cases.

Upload: vuminh

Post on 10-Feb-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

UNIT 3

May/June 2010

1) Explain the following

Equivalence Partitioning:-

Sol:- Equivalence partitioning is a software testing technique that divides the input data of

a software unit into partition of data from which test cases can be derived. In principle,

test cases are designed to cover each partition at least once. This technique tries to define

test case that uncovers classes of errors, thereby reducing the total number of test cases

that must be developed.

ii) Boundary Value Analysis:-

Boundary value analysis is software testing design technique in which tests are designed

to include representatives of boundary values. Values on the edge of an equivalence

partition or at the smallest value on either side of an edge are taken for testing. The values

could be either input or output ranges of a software component. Since these boundaries

are common locations for errors that result in software faults they are frequently exercised

in test cases.

2) Explain the steps for creating equivalence classes for the given problem requirements?

Soln:-

Systematic procedure for equivalence partitioning:-

1.Identify the input domain: Read the requirements carefully and identify all input and

output variables, their types, and any conditions associated with their use.Environment

Page 2: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

variables, such as class variables used in the method under test and environment variables

in UNIX, Windows, and other operating systems, also serve as input variables. Given the

set of values each variable can assume, an approximation to the input domain is the

product of these sets.

2.Equivalence classing: Partition the set of values of each variable into disjoint subsets.

Each subset is an equivalence class. Together, the equivalence classes based Test

Generation.On an input variable partition the input domain. Partitioning the input domain

using values of one variable, is done based on the expected behavior of the

program.Values for which the program is expected to behave in the ``same way" are

grouped together. Note that ``same way" needs to be defined by the tester.

3. Combine equivalence classes: This step is usually omitted and the equivalence

classes defined for each variable are directly used to select test cases. However, by not

combining the equivalence classes, one misses the opportunity to generate useful

tests.The equivalence classes are combined using the multidimensional partitioning

approach described earlier.

4. Identify infeasible equivalence classes: An infeasible equivalence class is one that

contains a combination of input data that cannot be generated during test. Such an

equivalence class might arise due to several reasons.For example, suppose that an

application is tested via its GUI, i.e. data is input using commands available in the GUI.

The GUI might disallow invalid inputs by offering a palette of valid inputs only. There

might also be constraints in the requirements that render certain equivalence infeasible.

3) Identify the steps in generation of tests in category partition Method? Explain any two?

Soln:- The Category partition Method is a systematic approach to the generation of test

from requirements. The method consists of a mix of manual and automated steps. A

method for creating functional test suites has been developed in which a test engineer

Page 3: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

analyzes the system specification, writes a series of formal test specifications, and then

uses a generator tool to produce test descriptions from which test scripts are written.

The method consists of the following steps:

1. Decompose the functional specification into functional units that can be tested

independently.

2. Identify the parameters (the explicit inputs to a functional unit) and environment conditions

(the state of the system at the time of execution) that affect the execution behavior of the

function.

3. Find categories (major properties or characteristics) of information that characterize each

parameter and environment condition.

4. Partition each category into choices, which include all the different kinds of values that are

possible for that category.

5. Determine the constraints among the choices of different categories. For example, one

choice may require that another is absent, or has a particular value.

6. Write the test specification (which is a list of categories, choices, and constraints in a

predefined format) using the test specification language TSL.

7. Use a generator to produce test frames from the test specification. Each generated test frame

is a set of choices such that each category contributes no more than one choice.

8. For each generated test frame, create a test case by selecting a single element from each

choice in that test frame.

Consider an application that requires two integer inputs x and y. Each of these inputs is

expected to lie in the following ranges: 3£ x£7 and 5£y£9.

Page 4: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

For one-dimensional partitioning we apply the partitioning guidelines to x and y individually.

This leads to the following six equivalence classes.

E1: x<3 E2: 3£x£7 E3: x>7 y ignored.

E1: x<3 E2: 3£x£7 E3: x>7 y ignored

For multidimensional partitioning we consider the input domain to be the set product X x Y.

This leads to 9 equivalence classes.

E1: x<3, y<5 E2: x<3, 5£y£9 E3: x<3, y>9

E4: 3£x£7, y<5 E5: 3£x£7, 5£y£9 E6: 3£x£7, y>9

E7: >7, y<5 E8: x>7, 5£y£9 E9: x>7, y>9

Systematic procedure

3b) Write Short notes on

i)Boundary Value Analysis

Boundary value analysis is software testing design technique in which tests are designed

to include representatives of boundary values. Values on the edge of an equivalence

partition or at the smallest value on either side of an edge are taken for testing. The values

could be either input or output ranges of a software component. Since these boundaries

Page 5: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

are common locations for errors that result in software faults they are frequently exercised

in test cases.

A Black Box Testing Method, complements to Equivalence partition and BVA leads to a

selection of test cases that exercise bounding values.

BVA: Procedure

1 Partition the input domain using one-dimensional partitioning. This leads to as many partitions

as there are input variables. Alternately, a single partition of an input domain can be created

using multidimensional partitioning. We will generate several sub-domains in this step.

2 Identify the boundaries for each partition. Boundaries may also be identified using special

relationships amongst the inputs.

3 Select test data such that each boundary value occurs in at least one test input. ii) Category

Partition Method:-

The Category partition Method is a systematic approach to the generation of test from

requirements.

The method consists of a mix of manual and automated steps. A method for creating

functional test suites has been developed in which a test engineer analyzes the system

specification, writes a series of formal test specifications, and then uses a generator tool to

produce test descriptions from which test scripts are written.

The main characteristics of the category-partition method include the following:

i)The test specification is a concise and uniform representation of the test information for a

function.

ii)The test specification can be easily modified, if this is necessitated by changes in the

functional specification of a command; mistakes in an original test specification; and a

Page 6: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

desire for more or fewer test cases. iii)The test specification gives the tester a logical way

to control the volume of tests.

iv)The generator tool provides an automated way to produce thorough tests for each function,

and to avoid impossible or undesirable combinations of parameters and environments.

v) The method emphasizes both the specification coverage and the error detection aspects of

testing.

May/June 2011

4) Explain the notation using Cause-effect Graphing and describe creation of

cause effect graph for GUI based Computer System?

Soln:-

The use of parameters qty and weight depends on the leftmost digit in code.

qty indicates the quantity purchased, an integer, when the left most digit is 0 or 3; weight

is ignored. weight is the weight of the item purchased when the leftmost digit is 2;

quantity is ignored. qty is the value of the discount when the leftmost digit is 5; again

weight is ignored.

when the leftmost digit is 5, the second digit from the left specifies dollar amount and the

third and fourth digits are cents.

Page 7: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

Steps used in Category –Partition Method

Step 1: Analyze specification

In this step, the tester identifies each functional unit that can be tested separately. For large

systems, a functional unit may correspond to a subsystem that can be tested Independently.

The subsystem can be further subdivided leading to independently testable subunits.The

subdivision process terminates depending on what is to be tested.In this example, we

assume that fP is an independently testable subunit of an application.

Thus we will derive tests for fP.

Step 2: Identify Categories

For each testable unit, the given specification is analyzed and the inputs isolated.In

addition, the objects in the environment, for example, file also need to be identified.Next,

the characteristics of each parameter and environment object is determined. A

characteristic is referred to as a Category.Some characteristics are stated explicitly, others

might need to be derived by a careful examination of the Specification. fP has three input

parameters: code, qty, weight.The specification mention various characteristics of these

Parameters such as their type and interpretation. qty and weight are related to code.The

database accessed by fP is an environment object.

code: length, leftmost digit, remaining digits qty: integer

weight: float

database: contents

Step 3: Partition Categories

Page 8: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

For each category, the tester determines different cases against which the functional unit

must be tested. Each case is also referred as a choice. It is useful to partition each category into

at least two subsets, a set containing correct values and another consisting of erroneous values.

code: length

Valid (eight digits)

Invalid (less than or greater than eight digits)

leftmost digit 0 2 3 5 and others.

remaining digits valid string invalid string (eg. 0X5987Y) qty: integer valid quantity invalid

quantity (eg. 0) weight: float valid weight invalid weight (eg. 0) Environments:

database:contentsitem exists item does not exist

Step 4: Identify Constraints

A test for a functional unit consists of a combination of choices for each parameter and

environment object.

Certain combinations might not be possible while others must satisfy specific relationships.

Constraints among choices are specified in this step.

A constraint is specified using a property list and a selector Expression. A property list has the following form:

[property P1, P2, ……]

Page 9: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

where property is a key word and P1, P2 etc. are names of Individual properties.Each

choice can be assigned a property.A selector expression is a conjunction of pre-defined

properties specified in some property list.

A selector expression takes one of the form:

[if P]

[if P and P2 and..]

The above two forms can be suffixed to any choice.

A special property written [error] can be assigned to choices that represent error

conditions.Another special property as [single] allows the tester to specify that the

associated choice is not to be combined with choices of other parameters, or environment

objects,while generating test frames in step 6. # Leftmost digit of code

0 [property ordinary-grocery]

2 [property variable-

weight] # Remaining

digits of the code

valid string

[single] #

Valid value

of qty

valid quantity [if ordinary-grocery]

# Incorrect value of qty

Page 10: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

invalid quantity [error]

Step 5: (Re) Write Test specification (TSL)

code:

length

Valid

Invalid

[error]

leftmost digit

0 [property ordinary-grocery]

2 [property variable-

weight]

3 [property Health-

related] 5

[property Coupon]

remaining

digits Valid

string Invalid

string [error]

qty:

Valid quantity

Invalid quantity

[error] weight:

Valid weight [if variable-weight]

Page 11: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

Invalid weight

[error]

Environments:

database:

conte

nts

item

exist

s

item does not exist [error]

Step 6: Process specification

Test case 2: (key = 1.2.1.0.1.1)

Length: valid

Leftmost digit:

2 Remaining

digits: valid qty:

ignored weight:

3.19 database:

item exists

Step 7: Evaluate generator output

Step 8: Generate Test scripts

A test script is a group of test cases

5) Briefly explain procedure for generating BOR Constraint set and BRO

Constraint set from Abstract syntax Tree of ca predicate Pr?

Soln:-

Page 12: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

Predicate testing: BOR testing criterion

A test set T that satisfies the BOR testing criterion for a compound predicate pr,guarantees the

detection of single or multiple Boolean operator faults in the implementation of pr.

T is referred to as a BOR-adequate test set and sometimes written as TBOR.

Predicate testing: BRO testing criterion

A test set T that satisfies the BRO testing criterion for a compound predicate pr,guarantees the

detection of single or multiple Boolean operator and relational operator faults in the

implementation of pr. T is referred to as a BRO-adequate test set and sometimes written as

TBRO.

Generation of BOR constraint set

We want to generate TBOR for: pr: a<b Ù c>d

First, generate syntax tree of

pr. 1. Generation of BOR

constraint set We will use the

following notation:

SN is the constraint set for node N in the syntax tree for pr.

SNt is the true constraint set for node N in the syntax tree for pr.

SNf is the false constraint set for node N in the syntax tree for pr.

SN= SNt È SNf .

Second, label each leaf node with the constraint set {(t), (f)}.

Page 13: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

We label the nodes as N1, N2, and so on for convenience.

Notice that N1 and N2 are direct descendents of N3 which is an AND-node.

Third, compute the constraint set for the next higher node in the syntax tree, in this

case N3. For an AND node, the formulae used are the following.

SN3t = SN1t Ä SN2t ={(t)} Ä {(t)}={(t, t)}

SN3f = (SN1f {t2}) ({t1} SN2f � � ��

= ({(f)} {(t)}) ({(t)} {(f)}) � � ��

= {(f, t)} {(t, f)} �

= {(f, t),{(t, f)}

Generation of TBOR As per our objective, we have computed the BOR constraint set for the root node of the

AST(pr). We can now generate a test set using the BOR constraint set associated with the

root node.

SN3 contains a sequence of three constraints and hence we get a minimal test set consisting of

three test cases. Here is one possible test set. TBOR ={t1, t2, t3}

t1=<a=1, b=2, c=6, d=5> (t, t)

t2=<a=1, b=0, c=6, d=5> (f, t)

t3=<a=1, b=2, c=1, d=2> (t, f)

Page 14: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

a<

b

c>

d

Ù

{(t), (f)}

N1 N2

N3

SN3={(t,t), (f, t), (t, f)}

a<b c>d

Ù {(t), (f)} {(t), (f)}

Generation of BRO constraint set

Recall that a test set adequate with respect to a BRO constraint set for predicate

pr,guarantees the detection of all combinations of single or multiple Boolean operator and

relational operator faults.

BRO constraint set The BRO constraint set S for relational expression e1 relop e2:

S={(>), (=), (<)}

Separation of S into its true (St) and false (Sf)components:

Page 15: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

relop: > St={(>)} Sf={(=), (<)}

relop: _ St={(>), (=)} Sf={(<)}

relop: = St={(=)} Sf={(<), (>)}

relop: < St={(<)} Sf={(=), (>)}

relop: _ St={(<), (=)} Sf={(>)}

Note: tN denotes an element of StN. fN denotes an element of

SfN BRO constraint set: Example

pr: (a+b<c)Ù!p Ú (r>s)

Step 1: Construct the AST for the given predicate.

P r>s Ù a+b<c ! Ú N1 N4 N2

Step 2: Label each leaf node with its constraint set S.

Step 3: Traverse the tree and compute constraint set for each internal node.

StN3=SN2f={(f)} SfN3=SN2t= {(t)}

StN4=SN1t Ä SN3t={(<)} Ä{(f)}={(<, f)}

SfN4= (SfN1 × {(tN3)}) È ({(tN1)} × SfN3)

=({(>,=)} ×{(f)}) È {(<)} ×{(t)})

Page 16: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

={(>, f), (=, f)} È {(<, t)}

={(>, f), (=, f), (<, t)}

P r>s Ù a+b<c ! Ú N1N4N2N6N5N3

Next compute the constraint set for the root node (this is an OR-node).

SfN6=SfN4 SfN5 ��

={(>,f),(=,f),(<,t)} {(=),(<)}={(<, f)} �

={(>,f,=), (=,f,<),(<,t,=)}

StN6= (StN4 {(fN5)}) ({(fN4)} StN5) �� �� ��

=({(<,f)} {(=)}) {(>,f)} {(>)}) � �� �

={(<,f,=)} {(>,f,>)} ��

={(<,f,=),(>,f,>)}

Constraint set for pr: (a+b<c) !p (r>s) � ��

Dec 2011

6) What is Equivalence Partitioning? Explain Equivalence Partitioning with

Boiler Control System Example?

Soln:-

Page 17: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

Boiler control example (BCS)

The control software of BCS, abbreviated as CS, is required to offer several options.One of the

options, C (for control), is used by a human operator to give one of four commands (cmd):

change the boiler temperature (temp), shut down the boiler (shut), and cancel the request

(cancel).

Command temp causes CS to ask the operator to enter the amount by which the

temperature is to be changed (tempch). Values of tempch are in the range -10..10 in

increments of 5 degrees Fahrenheit. An temperature change of 0 is not an option.

Selection of option C forces the BCS to examine variable V. If V is set to GUI, the

operator is asked to enter one of the three commands via a GUI. However, if V is set to

file, BCS obtains the command from a command file.

The command file may contain any one of the three commands, together with the value of the

temperature to be changed if the command is temp. The file name is obtained from variable F.

Page 18: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions

Values of V and F can be altered by a different module in BCS.

In response to temp and shut commands, the control software is required to generate appropriate

signals to be sent to the boiler heating system.

We assume that the control software is to be tested in a simulated environment. The tester

takes on the role of an operator and interacts with the CS via a GUI.

The GUI forces the tester to select from a limited set of values as specified in the requirements.

For example, the only options available for the value of tempch are -

10, -5, 5, and 10. We refer to these four values of tempch as t-valid while all other values as

tinvalid.

BCS: 1. Identify input domain

The first step in generating equivalence partitions is to identify the (approximate) input

domain. Recall that the domain identified in this step will likely be a superset of the

complete input domain of the control software.

First we examine the requirements, identify input variables, their types, and values.

These are listed in the following table.

Page 19: UNIT 3 - Navodaya Institute of Technology, Web viewsystem specification, writes a series of formal test specifications, and then uses a generator tool to produce test descriptions