7. Portions from Some Chapters

Equivalence Partitioning (EP)

Equivalence Classes (EC) : Two or more test cases are equivalent if they all test the same thing. If one of them can not detect a given type of defect, others too can not detect the same. If one of them can detect a given type of defect, others too can detect the same.

Equivalence Partitioning (EP) comprises selecting one test-case from each equivalence class. If you expect the same/similar result from two tests, use only one of them.

Purpose : Filter out redundant test-cases. Select effective test-cases from a huge set of possibilities. To save time and labour, minimise number of test cases, but maximise coverage.

Illustrative example : Tabulated below are rows of data. Each row has 4 columns. Domain of each column is first given, followed by sets of equivalent test-data rows. One out of each set is sufficient for testing.

Set

Col-1

Column-2

Col-3

Column-4

 

Remarks

 

0 to

999

Only

Today’s

Date

1 to 3

-999,999,999,999.99 to

999,999,999,999.99

ß

Legal Values / Domains of each Column of the Test Data Rows.

Test Data Rows : Below are given just a few sets for sake of illustration.

Actually, there would be many more  Equivalence Classes (EC) over and above those below.

1

112

7.Apr.2004

1

-1,678.23

 

The highlighted (bold) row suffices out of  this set of 3 rows. 

1

1

7.Apr.2004

2

-999,999,999,999.99

ï

1

891

7.Apr.2004

3

-448,123,889,551.98

 

2

662

7.Apr.2004

2

876,281.00

 

The highlighted (bold) row suffices out of  this set of 3 rows. 

2

999

7.Apr.2004

1

999,999,999,999.99

ï

2

381

7.Apr.2004

3

222,111,001.05

 

3

333

5.Apr.2004

2

333,333.33

 

Testing for one date less that today’s date may be sufficient. Hence, use just one row out of the three.

3

222

6.Apr.2004

1

222.00

ï

3

444

4.Apr.2004

3

444,444,444.44

 

4

222

7.Apr.2004

5

222.00

 

Testing for one code greater than 3 may be sufficient. Hence, use just one row out of the three.

4

333

7.Apr.2004

4

333,333.33

ï

4

444

7.Apr.2004

6

444,444,444.44

 

 From the tabulation, it would be seen that EP basically comprises partitioning the input domain of a program into a finite number of equivalence classes such that testing one representative row of test-data of one equivalence class is same as testing with all the rows of test-data of that equivalence class. If through trial and error it is found that different rows of an equivalence class are treated differently by the target under test, sub-divide the equivalence class till all rows per equivalence class are practically equivalent.


Boundary Value Analysis (BVA)

Check for boundary values. For example, for months = 1 to 12 (Jan. to Dec.), check for boundary values - 1 and 12 ; and for values just beyond the boundaries – 0 and 13. Also check for null.

Similarly for weekdays = 1 to 7 (Mon. to Sun.), check for 1, 7, 0, 8 and Null.

Boundary checks are also illustrated below for rows with 4 columns as under :

Column-1

Column-2

Col-3

Column - 4

Remarks

0 to

999,999,999

Only

Today’s

Date

1 to 3

Non-zero,

-999,999,999,999.99 to

999,999,999,999.99

ï Allowed Values

0

7.Apr.2004

1

1.01

Col-1: Min. Boundary Value.

999,999

7.Apr.2004

2

-1.01

Col-1: In-between Value.

999,999,999

7.Apr.2004

3

999,999,999.99

Col-1: Max. Boundary Value.

-1

7.Apr.2004

1

999,999.99

Col-1: 1 less than Min. Boundary Value.

1,000,000,000

7.Apr.2004

2

11,256.55

Col-1: 1 more than Max. Boundary Value.

Null

7.Apr.2004

3

-77,000.11

Col-1: Null.

 

 

 

 

Col-2: Legal Values checked above.

222

6.Apr.2004

1

222.00

Col-2: 1 less than Min. Boundary Value.

444,444,444

8.Apr.2004

2

444,444,444.44

Col-2: 1 more than Max. Boundary Value.

5182

Null

3

-444,444,444.44

Col-2: Null.

 

 

 

 

Col-3: Boundary Values checked above.

69,277

7.Apr.2004

0

-2,989.01

Col-3: 1 less than Min. Boundary Value.

333,333

7.Apr.2004

4

333,333.33

Col-3: 1 more than Max. Boundary Value.

1,111

7.Apr.2004

Null

-888,888,888.88

Col-3: Null.

 

 

 

 

Col-4: Legal Values checked above.

101

7.Apr.2004

1

-999,999,999,999.99

Col-4: Min. Boundary Value.

2,222

7.Apr.2004

2

999,999,999,999.99

Col-4: Max. Boundary Value.

33,333

7.Apr.2004

3

0

Col-4: Illegal Value

444,444

7.Apr.2004

1

-1,000,000,000,000.00

Col-4: 1 less than Min. Boundary Value.

5,555,555

7.Apr.2004

2

1,000,000,000,000.00

Col-4: 1 more than Max. Boundary Value.

66,666,666

7.Apr.2004

3

Null

Col-4: Null.


1)                 State Machines (SM)

In general, a state machine is any device that (a)has an initial status, (b)changes and stores status on application of an input, and/or (c)cause an action or output.

Examples :

ú A computer itself is basically a state machine and each machine instruction is input that changes one or more states and may cause other actions to take place. Each computer's data register stores a state. The ROM from which a boot program is loaded stores a state. The boot program itself is an initial state. The operating system is itself a state and each application that runs begins with some initial state that may change as it begins to handle input. Thus, at any moment in time, a computer system can be seen as a very complex set of states and each program in it as a state machine.

ú ATM : Automated Teller Machine.

ú Tele-Banking.

ú A vending machine.

 A state machine can be described as:

Properties of a State Machine

Example of ATM : Automated Teller Machine

A set of unique states.

Initial/Ready-to-Service Mode, Card Reading, Display of a Screen of Options, Cash Dispension, ....

One special state – the initial state.

Ready-to-Service Mode.

One or more final states. When the machine reaches these, it exits.

End of cash dispension by an ATM, or

Screen upon pressing of "EXIT" option or ...

A set of possible inputs.

Option for cash dispension or balance enquiry or ...

A set of new states that may result from the inputs.

Display of the next screen of options, etc.

A set of possible actions or output events that result from a new state.

Printing Statement of A/c, Cash Dispension, Display of Balance, etc.

For the purpose of testing, where relevant, state table comprising possible inputs, corresponding states and expected actions/outputs can be tabulated.

ATM, Black-box Testing and State Machine : In respect of an ATM, starting from initial state, each user action – inserting card, typing in PIN, pressing keys for various options, to exit – and can be mapped to corresponding ATM state, and appropriate action like displaying a message, showing balance, dispensing cash, printing ATM slip, etc. Tabulation of alternate logical sequences of inputs, the corresponding states, and the expected ATM actions/outputs is the most appropriate way to guide the testing process.

Program Code, White-box Testing and State Machine : Examine if a program with many flags/flag-variables and/or deeply nested if-then-else or choose-case statements can be mapped to a state machine for testing purpose.

Program Design and State Machine and its Testing : Mapping activities in modules like "Order-Processing" to a State Machine make for clearer design, parameterised and maintainable code, testable requirements and testable design and code. For example, web-based books ordering system would involve, inter alia, selection of books, display of total cost, confirmation, options to pay by credit cards, etc. The stages/states can be better handled and captured and flexibly coded using a database table.


 

Tests requiring BoD, EoD, Roll forward

BoD=Begin-Day Processing, EoD = End-Day Processing.
Roll forward to the next transaction date.


Parallel Run of  Old & New Version


Comments