Testcover.com Testcover.com
Shopping Cart Example -
Test Model Mapping
Transition Model Target State Model Shopping Cart States
Partition
Prefix
FD Form
Partition
& Block
FV Form
Partition
& Block(s)
Partition
Prefix
FD Form
Partition
& Block
FV Form
Partition
& Block(s)
from to Notes FD Form
event
FV Form
values
SEP1B1 P1B1 EP1B1 P1B1 shoppingemptyCart CART
NEP2B1 P2B1 EP1B2 P1B2 nonemptyCartemptyCart an=1 UPDATE
NEP2B2 P2B2 EP1B3 P1B3 nonemptyCartemptyCart bn=1 UPDATE
NEP2B3 P2B3 EP1B4 P1B4 nonemptyCartemptyCart cn=2 UPDATE
NEP2B4 P2B4 EP1B5 P1B5 nonemptyCartemptyCart dn=3 UPDATE
SNP3B1 P3B1 NP2B1 P2B1 shoppingnonemptyCart en=0 CART
SNP3B2 P3B2 NP2B2 P2B2-4 shoppingnonemptyCart en=1 CARTnewQ[0]=qty[0]=1,2,10
SNP3B3 P3B3 NP2B3 P2B5-13 shoppingnonemptyCart en=2 CARTnewQ[0]=qty[0]=1,2,10
newQ[1]=qty[1]=1,2,10
SNP3B4 P3B4 NP2B4 P2B14-40 shoppingnonemptyCart en=3 CARTnewQ[0]=qty[0]=1,2,10
newQ[1]=qty[1]=1,2,10
newQ[2]=qty[2]=1,2,10
NNP4B1 P4B1 NP2B5 P2B41 nonemptyCartnonemptyCart fn=1 CHECK(i)i=0
NNP4B2 P4B2-3 NP2B6 P2B42-43 nonemptyCartnonemptyCart fn=2 CHECK(i)i=0,1
NNP4B3 P4B4-6 NP2B7 P2B44-46 nonemptyCartnonemptyCart fn=3 CHECK(i)i=0,1,2
NNP4B4 P4B7-10 NP2B8 P2B47-50 nonemptyCartnonemptyCart gn=1 QTY(i,q)i=0
q=0,1,2,10
NNP4B5 P4B11-18 NP2B9 P2B51-58 nonemptyCartnonemptyCart gn=2 QTY(i,q)i=0,1
q=0,1,2,10
NNP4B6 P4B19-30 NP2B10 P2B59-70 nonemptyCartnonemptyCart gn=3 QTY(i,q)i=0,1,2
q=0,1,2,10
NNP4B7 P4B31 NP2B11 P2B71 nonemptyCartnonemptyCart hn=1 UPDATE
NNP4B8 P4B32 NP2B12 P2B72 nonemptyCartnonemptyCart in=2 UPDATE
NNP4B9 P4B33 NP2B13 P2B73 nonemptyCartnonemptyCart jn=3 UPDATE
CNP5B1 P5B1 NP2B14 P2B74-76 checkoutnonemptyCart en=1 CARTnewQ[0]=qty[0]=1,2,10
CNP5B2 P5B2 NP2B15 P2B77-85 checkoutnonemptyCart en=2 CARTnewQ[0]=qty[0]=1,2,10
newQ[1]=qty[1]=1,2,10
CNP5B3 P5B3 NP2B16 P2B86-112 checkoutnonemptyCart en=3 CARTnewQ[0]=qty[0]=1,2,10
newQ[1]=qty[1]=1,2,10
newQ[2]=qty[2]=1,2,10
ESP6B1 P6B1 SP3B1 P3B1 emptyCartshopping SHOP
NSP7B1 P7B1 SP3B2 P3B2 nonemptyCartshopping n=1 SHOP
NSP7B2 P7B2 SP3B3 P3B3 nonemptyCartshopping n=2 SHOP
NSP7B3 P7B3 SP3B4 P3B4 nonemptyCartshopping n=3 SHOP
NCP8B1 P8B1 CP4B1 P4B1 nonemptyCartcheckout n=1 CHECKOUT
NCP8B2 P8B2 CP4B2 P4B2 nonemptyCartcheckout n=2 CHECKOUT
NCP8B3 P8B3 CP4B3 P4B3 nonemptyCartcheckout n=3 CHECKOUT

PmBn = Partition m, Block n.

Each row of this table identifies corresponding blocks of the four state machine test designs in the shopping cart example. These blocks, in the order given, are contained in the requests (shown in the yellow backgrounds) of the designs referenced below.

Each transition design illustrates a plan to test the 8 transitions among the 4 leaf states. A separate partition is used for each of the 8 transitions. In partitions 3, 4 and 5, transitions to the nonemptyCart state involve functionally dependent factor values. These are expressed both in functionally dependent (FD) form and in fixed values (FV) form. A procedure describes the conversion of a request in functionally dependent form to fixed values form.

Each target state design groups the 8 transition partitions into 4 target state partitions for a reduced number of test cases. Each block in the target state design has the same test values as the corresponding block in the transition design. In partition 2, transitions to the nonemptyCart state involve functionally dependent factor values. These are expressed both in functionally dependent (FD) form and in fixed values (FV) form. A procedure describes the conversion of a request in functionally dependent form to fixed values form.

Notes:
a. To empty the cart delChk[0]=1; any value of newQ[0] is allowed.
b. To empty the cart any value of delChk[0] is allowed; newQ[0]=0.
c. To empty the cart delChk[0]=1 and newQ[1]=0 in this representative block. To allow all ways to empty the cart of 2 items, include 3 more blocks: delChk[0]=1 and delChk[1]=1; newQ[0]=0 and delChk[1]=1; and newQ[0]=0 and newQ[1]=0.
d. To empty the cart delChk[0]=1; delChk[1]=1; and newQ[2]=0 in this representative block. To allow all ways to empty the cart of 3 items, include blocks for all 8 combinations. For up to 3 items in the cart, 14 blocks (2+4+8) allow all ways to empty it. Generally, when there are up to n items in the cart, 2(2n-1) blocks allow all ways to empty it.
e. In both functionally dependent forms newQ[0]=qty[0]; newQ[1]=qty[1]; newQ[2]=qty[2]. In the transition design each of newQ[0], newQ[1] and newQ[2] is one function of one factor; the functionally dependent and fixed values forms are equivalent. In the target state design each factor is not one function of one factor; the values are given explicitly in the fixed values form. The target state design fixed values form has 3n blocks for each block of the other designs (one block for each combination of nonzero quantities in filled cart positions).
f. Each functionally dependent form block maps to n block(s) in fixed value form (one block for each filled cart position).
g. Each functionally dependent form block maps to 4n blocks in fixed value form (one block for each allowed quantity in each filled cart position).
h. To keep a nonempty cart delChk[0]=0; any nonzero value of newQ[0] is allowed.
i. To keep a nonempty cart delChk[1]=0 with any nonzero value of newQ[1] is allowed in this representative block (with all allowed values of delChk[0] and newQ[0]). To allow all ways to keep a nonempty cart starting with 2 items, include one more block: delChk[0]=0 with any nonzero value of newQ[0] and with all allowed values of delChk[1] and newQ[1].
j. To keep a nonempty cart delChk[2]=0 with any nonzero value of newQ[2] is allowed in this representative block (with all allowed values of delChk[0], newQ[0], delChk[1] and newQ[1]). To allow all ways to keep a nonempty cart starting with 3 items, include 3 blocks for the combinations which keep each of the items in the cart. For up to 3 items in the cart, 6 blocks (1+2+3) allow all ways to keep it nonempty. Generally, when there are up to n items in the cart, n(n+1)/2 blocks allow all ways to keep the cart nonempty.

Copyright © 2003-2018 Testcover.com, LLC. All rights reserved.