0% found this document useful (0 votes)
415 views27 pages

Universiti Pendidikan Sultan Idris Pentaksiran Akhir SEMESTER 2 SESI 2020/2021

The document provides instructions for a final assessment for a Software Testing and Quality course. It includes details of the course code, lecturer, student registration information, and instructions for the assessment. The assessment consists of three main questions related to specifications for an online shopping application for purchasing assorted chips. Students are required to answer all questions, save their responses with a specific file naming convention, and submit their answers to the lecturer by the specified time.

Uploaded by

Mahadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
415 views27 pages

Universiti Pendidikan Sultan Idris Pentaksiran Akhir SEMESTER 2 SESI 2020/2021

The document provides instructions for a final assessment for a Software Testing and Quality course. It includes details of the course code, lecturer, student registration information, and instructions for the assessment. The assessment consists of three main questions related to specifications for an online shopping application for purchasing assorted chips. Students are required to answer all questions, save their responses with a specific file naming convention, and submit their answers to the lecturer by the specified time.

Uploaded by

Mahadi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

SULIT / CONFIDENTIAL

UNIVERSITI PENDIDIKAN SULTAN IDRIS

PENTAKSIRAN AKHIR
FINAL ASSESSMENT
SEMESTER 2 SESI 2020/2021
SEMESTER 2 SESSION 2020/2021

KOD / CODE : MES3053 KURSUS : PENGUJIAN DAN KUALITI


PERISIAN
COURSE : SOFTWARE TESTING AND
QUALITY

ARAHAN / INSTRUCTIONS
1. Sila baca arahan pentaksiran dengan teliti.
Please read the assessment instructions carefully.

2. Pelajar dikehendaki menyediakan skrip jawapan mengikut kepada pentaksiran akhir yang
telah ditetapkan.
Students are required to prepare the answer scripts based on the predetermined the final
assessment.

3. Pelajar dikehendaki menyerahkan skrip jawapan kepada pensyarah dalam tempoh masa
yang telah ditetapkan.
Students are required to submit their answer scripts to the lecturers within the specified time.

PROGRAM / PROGRAMME: Bachelor of Software Engineering

TAHUN / YEAR: 2021 KUMPULAN KULIAH / CLASS GROUP: A

NO. PENDAFTARAN / REGISTRATION NO: D20182 0 8 6 5 6 1

NO. KAD PENGENALAN / I.C. NO: B P 0 6 5 2 4 7 8

PENSYARAH / LECTURER: PN. ROHAIZAH BINTI ABDUL WAHID

SULIT / CONFIDENTAL
MES3053 Software Testing and Quality 2

INSTRUCTIONS

1. This question paper consists of THREE(3) main questions.

2. Answer ALL questions in this question paper and rename the file using the following
naming convention:
FAS_MES3053_A201_GX_DYYYYYY
where X = group name and Y = last 6 digits of your matric number

3. You are allow to use any software tools or hand-written sketch for any questions that
needs to answer in a form of diagram or illustration.

4. You may scan or copy and paste your diagram/illustration on the relevant answer section.

5. If you need to attach your diagram using different file from this question paper, please
name the file using number of the question together with your 6 digits matric number.
MES3053 Software Testing and Quality 3

INSTRUCTION: Answer ALL questions (80 marks).

1. The following figure describe the specification of purchasing assorted chips in Sekudap
online store using ShopLaLa shopping platform. Answer all questions below based on the
specifications.

Purchasing function will calculates the total price of the order that user add in
his/her shopping cart. The function should take the weight of the chips pack
(available in 500gm and 1kg) and the required quantity of pack as input, and
output is the total price of the order. The basic cost for every pack of 500g is
RM15 and a pack of 1kg is RM25. The maximum order for one parcel of delivery
is 50kg. Purchasing over than that must be made in separate order. Discounts
are available for bulk orders. If the user order between 10kg and 29kg, they
usually qualify for a 10% discount, while if they order 30kg or more, they are
qualify for a 20% discount. Additional 1% discount will be given if the user using
a valid coupon code. If the user using e-wallet to make a payment, the user can
get free shipping fee. Otherwise, the shipping fee will be issued for RM5 for the
total weight below 5kg and RM20 for more than that. Discount amounts are
added to the total price, if applicable. A test input is a pair (weight, quantity of
pack). If a given input’s value for weight is invalid, the system will gives a warning
message “weight is invalid”. If the total weight for quantity of packs is more than
50kg, the system will gives a warning message “Total purchase is more than
50kg”.

Figure 1: Specification and business logic of purchase order.

i. Find equivalence classes (EP) for all input of the purchasing order in Figure 1.0.
[6 marks]
Answer to the Question No 1 (i)

Input: Weight

Invalid 1 : < 500gm


Valid 1 : = 500gm
Invalid 2 : > 500gm and < 1kg

[See next page


MES3053 Software Testing and Quality 4

Valid 2 : = 1kg
Invalid 3 : > 1kg

Input: Quantity of packs (For 500gm)

Invalid 1 : < 1
Valid : > 1 and < 101
Invalid 2 : > 100

Input: Quantity of packs (For 1kg)


Invalid 1 : < 1
Valid : > 1 and < 51
Invalid 2 : > 50

ii. Find boundary values for all input of the specification in Figure 1.0 by using BVA.
You can use a time line or just state the possible values.
[6 marks]

Answer to the Question No 1 (ii)

 Possible values for weight: 500gm and 1kg


 Possible values for Quantity: 1,2,3,4,5,6…….,96,97,98,99,100 for 500gm weight
 Possible values for Quantity: 1,2,3,4,5,6…….,46,47,48,49,50 for 1kg weight

iii. Write possible test cases for the input of the purchase order based on your answer
in 1(i).
(Note: Each test case should be written in one sentence which consist of test
condition along with the sample of test data, followed by the expected result. E.g. –
Username[“aminah”] and password[“abc1234”] both were correct, and the user
navigated to the homepage.)
[4 marks]

Answer to the Question No 1 (iii)

[See next page


MES3053 Software Testing and Quality 5

Case 1: Weight [“500gm”] and Quantity [“20”] both were correct and user navigated to the
discount page.

Case 2: Weight [“1kg”] and Quantity [“35”] both were correct and user navigated to the discount
page.

Case 3: Weight [“750gm”] was wrong and Quantity [“35”] was correct and user has been shown
“weight is invalid” by the system.

Case 4: Weight [“500gm”] was correct and Quantity [“125”] was wrong and user has been
shown “Total purchase is more than 50kg” by the system.

Case 5: Weight [“1kg”] was correct and Quantity [“55”] was wrong and user has been shown
“Total purchase is more than 50kg” by the system.

Case 6: Weight [“2kg”] and Quantity [“55”] both were wrong and user has been shown “weight is
invalid” and “Total purchase is more than 50kg” by the system.

iv. Construct a decision table for the business logic of total price calculation in Figure 1.
[16 marks]

Answer to the Question No 1 (iv)

Decision table:
Condition Rule 1 Rule 2 Rule 3 Rule 4
Weight T T F F
Quantity T F T F
Total Weight T F F F
Output T F F F

[See next page


MES3053 Software Testing and Quality 6

Decision table for the business logic of total price calculation:


Condition Cost (RM) Discount Valid Coupon Shipping Fee
(Input) (RM)
500gm 15 - 1% 5
1kg 25 - 1% 5
Below 5kg Ø (kg) × 25 - 1% 5
5kg-10kg Ø (kg) × 25 - 1% 20
10kg-29kg Ø (kg) × 25 10% 1% 20
Above 30kg Ø (kg) × 25 20% 1% 20

Here Shipping fee is free only when payment method is E-wallet. For cash and cards, as per
above table.

Output = Cost – Discount – Coupon + Shipping fee (where discount = % of total cost)

Example: If I order 16kg, I need to pay,


(16 × 25) – (10% + 1%) + 20 = 376RM.

v. Derive test cases from the decision table that you made in answer 1(iv).
(Note: Each test case should be written in one sentence which consist of test
condition along with the sample of test data, followed by the expected result. E.g. –
Username[“aminah”] and password[“abc1234”] both were correct, and the user
navigated to the homepage.)
[8 marks]
Answer to the Question No 1 (v)

Test Case Test Case Test Steps Test Data Expected Actual Status
ID Description Result Result (pass/fail)
TC_001 Verify 1) Select Item add to Amount Amount Pass
whether the item cart: Chips calculated calculated
Purchasing 2) Add item correctly correctly

[See next page


MES3053 Software Testing and Quality 7

function to the cart


calculate the
total price of
order that is
added into
cart
TC_002 Verify the 1) Item Weight of Weight Weight Pass
item :1KG select before
function Select selected
adding item
should take 2) select to cart before
Show
the weight of adding item
amount of
Weight of item item to cart
added in
Item Eg - 3) Add to Showed
cart
500 gm or cart amount of
1KG item
added in
cart
TC_003 Verify the 1) Item Weight of Should show Weight is Pass
Weight of Select item: -399 warning of Invalid
Item entered 2) select kg Weight is please enter
is valid weight of Invalid valid weight
item
3) Add to
cart
TC_004 Verify 1) Item weight of Check the The cost of Pass
whether the Select item: 1KG cost of item item is
basic cost of 2) select item added is correctly
500gm weight of to cart correct considered
is RM15 and item
1 KG is 3) Add to
RM25 cart
TC_005 Verify that 1) Item weight of weight weight Pass
one parcel Select item: 50KG exceed than exceed than
weight 2) select item added 50kg then 50kg and it
exceed weight of to cart consider as is accepting
than 50 kg item a as a
then make it 3) Add to separate separate
a separate cart order and order

[See next page


MES3053 Software Testing and Quality 8

parcel show "Total


and also warning purchase is
show the message more
warning than 50 kg"
TC_006 Verify the 1) Item weight of Check the The discount Pass
Discount is Select item: 51KG discount is is
given on 2) select item added given on given on
bulk weight of to cart bulk amount bulk amount
amount of item
order 3) Add to
cart
TC_007 Verify 1) Item weight of Check The discount Pass
whether the Select item: 20KG whether the is given of
discount is 2) select item added discount is 10% on
given of weight of to cart given of 10kg to 29kg
10% on item 10% on
10kg to 29kg 3) Add to 10kg to 29kg
cart
TC_008 Verify 1) Item weight of Check The discount Pass
whether the Select item: 35KG whether the is given of
discount is 2) select item added discount is 10% on
given of weight of to cart given of 10kg to 29kg
20% on item 10% on
30kg or 3) Add to 10kg to 29kg
more cart
TC_009 Verify 1) Item weight of Check The discount Pass
whether the Select item: 25KG whether the is given of
discount is 2) select item added discount is 1% after
given of weight of to cart given of entering
1% when item 1% on valid
given a valid 3) Add to entering coupon code
coupon code cart valid
coupon code
TC_010 Verify 1) Item weight of Check The free Pass
whether the Select item: 10KG whether the shipping is
user get free 2) select item added free given on
shipping weight of to cart shipping is payment

[See next page


MES3053 Software Testing and Quality 9

if done item given if done


payment 3) Add to payment through E-
through e- cart done wallet
wallet through
E-wallet

TC_011 Verify the 1) Item weight of Check Check Pass


user issue a Select item: 10KG whether the whether the
shipping 2) select item added shipping shipping
charge weight of to cart charges are charges are
RM5 for item RM20 RM20
weight 3) Add to
below 5kg cart
and RM20
for
more that
5kg if
payment is
not done
through e-
wallet

[See next page


MES3053 Software Testing and Quality 10

2. Consider the following excerpt from the use case “modify shopping cart” for ShopLala
online shopping system:

Brief Descriptions: User make a modification (update/remove) to their shopping


cart.
Pre-conditions: User has a registered account in the system and has logged on to
the system.

Main scenario steps:


1. A user click “View cart” button.
2. System display user’s shopping cart record on the cart page.
3. User chooses the product they wish to modify (update or remove) by marking
up the option button available beside the product record.
4. A user click the “Remove” button.
5. System update the shopping cart record based on the operation.
6. System will refresh the shopping cart page.

Alternative paths:
3a-1. A user change the quantity desired and then click “Update” button.
3a-2. System will confirm the current quantity available for the product.
3a-3. The current number of quantities is sufficient. Then, go to step 5.

Exceptions:
3a-3b. The current number of quantities are not available anymore/ not sufficient.
Then, repeat step 3a-1.

Post-conditions: The user shopping cart has been updated and then user has the
options to continue shopping or proceed to checkout.

Figure 2: Use case for modify shopping cart

i. Identify how many test cases that can be derived from the above use case and write
the test cases.The test case should consist of test case id, test case description, test
case step, test data and expected result.

[16 marks]

[See next page


MES3053 Software Testing and Quality 11

Answer to the Question No 2 (i)


Test case 1
Test Case ID Test Case Test Case Test Case Test case
Description Steps Data Expected
Results
TC001 User clicks i) User enters id Products added After clicking on
“view cart” and password to cart “view cart”
button. button cart item
ii) User login to show.
online shopping
system account

iii) User selects


cart option

iv) User clicks


on view cart
button

Test case 2
Test Case ID Test Case Test Case Test Case Test case
Description Steps Data Expected
Results
TC002 Show shopping i) User enters id Product added Cart record of
cart record and password to cart User opens

ii) User login to


online shopping
system account

iii) User selects

[See next page


MES3053 Software Testing and Quality 12

cart option

iv) User clicks


on “view cart”
button

v) Cart record
displays

Test case 3
Test Case ID Test Case Test Case Test Test case Expected
Description Steps Case Results
Data
TC003 User choose i) User enters id Product Choose product from
product wish to and password category product record.
modify by
marking up ii) User login to
option button online shopping
available beside system account
product record
iii) User selects
category of
product

iv) Opens
product records

Test case 4
Test Case ID Test Case Test Case Test Case Test case
Description Steps Data Expected
Results

[See next page


MES3053 Software Testing and Quality 13

TC004 User click i) User enters id Products Extra products


“Remove” and password remove from
button cart
ii) User login to
online shopping
system account

iii) User selects


cart option

iv) User clicks


on “view cart”
button

v) Cart record
displays

vi) If product
limit on cart is
out of limit

vii) Remove the


product from
cart

Test case 5
Test Case ID Test Case Test Case Test Case Test case
Description Steps Data Expected
Results
TC005 Update i) User enters id Products Update cart
shopping cart and password record

ii) User login to

[See next page


MES3053 Software Testing and Quality 14

online shopping
system account

iii) User selects


cart option

iv) User clicks


on view cart
button

v) Cart record
displays

vi) Remove cart


extra products

vii) Update cart

Test case 6
Test Case ID Test Case Test Case Test Case Test case
Description Steps Data Expected
Results
TC006 Refresh i) User enters id Products Refresh cart
shopping cart and password record page.
page
ii) User login to
online shopping
system account

iii) User selects


cart option

iv) User clicks

[See next page


MES3053 Software Testing and Quality 15

on view cart
button

v) Cart record
displays

vi) Remove cart


extra product

vii) Update cart

viii) Refresh
shopping cart

[See next page


MES3053 Software Testing and Quality 16

3. The following fragment of code in Figure 3 shows the function to identify prime numbers
that exist for the given range of numbers. A a tester, you need to design the test using
control-flow techniques as stated on the following questions.

int identifyPrimeNo (int maxNo) {

int i, n;
bool isPrime;

for(n = 2; n < maxNo; n++) {


isPrime = true;

for(i = 2; i <= n/2; i++) {


if (n%i == 0) {
isPrime = false;
break;
}
}

if(isPrime == true)
cout << n << " ";
}
return 0;
}

Figure 3: Fragment of prime number identification function.

i. Draw the control flow graph of the code.


[12 marks]
Answer to the Question No 3 (i)

The control flow diagram of the given code is drawn below,

[See next page


MES3053 Software Testing and Quality 17

[See next page


MES3053 Software Testing and Quality 18

[See next page


MES3053 Software Testing and Quality 19

ii. Find (a minimum) path that achieves 100% statement coverage. Then, draw the
path(s) with the coloured line or state the sequence of every path that you find
(example: S1C1 S2).
[2 marks]
Answer to the Question No 3 (ii)

Here the path that achieves 100% statement coverage is given below-
S1 → S2 → C1 → S3 → S4 → C2 → C3 → S5 → C4 → S6 → S7 → C1 → S8

Below the drawn colored path is given-

[See next page


MES3053 Software Testing and Quality 20

[See next page


MES3053 Software Testing and Quality 21

iii. Find (a minimum) path that achieves 100% branch coverage. Then, draw the path(s)
with the coloured line or state the sequence of every path that you find (example:
S1C1 S2).
[4 marks]
Answer to the Question No 3 (iii)

Here the path that achieves 100% statement branch is given below-
 S1 → S2 → C1 → S3 → S4 → C2 → C3 → S5 → C4 → S6 → S7 → C1 → S8 (Red line)
 S1 → S2 → C1 → S8 (Orange line)
 S1 → S2 → C1 → S3 → S4 → C2 → C1 → S8 (Green line)
 S1 → S2 → C1 → S3 → S4 → C2 → C3 → C2 → C1 → S8 (Blue line)
 S1 → S2 → C1 → S3 → S4 → C2 → C3 → C2 → C3 → S5 → C4 → S6 → S7 → C1 →
S8 (Sky blue line)
 S1 → S2 → C1 → S3 → S4 → C2 → C3 → S5 → C4 → S7 → C1 → S8 (Yellow line)

Below the drawn colored path is given-

[See next page


MES3053 Software Testing and Quality 22

[See next page


MES3053 Software Testing and Quality 23

iv. Find (a minimum) path that achieves 100% decision coverage. Then, draw the
path(s) with the coloured line or state the sequence of every path that you find
(example: S1C1 S2).
[2 marks]
Answer to the Question No 3 (iv)

Here the path that achieves 100% Decision coverage is given below-
S1 → S2 → C1 → S3 → S4 → C2 → C3 → S5 → C4 → S6 → S7 → C1 → S8

Below the drawn colored path is given-


MES3053 Software Testing and Quality 24
MES3053 Software Testing and Quality 25

v. Calculate the Cyclomatic Complexity value for the program in Figure 3.


[4 marks]
Answer to the Question No 3 (v)
MES3053 Software Testing and Quality 26
MES3053 Software Testing and Quality 27

We know Cyclomatic Complexity value = no of edges - no of nodes + 2

=15 – 12 + 2

=5

END OF QUESTION

You might also like