Professional Documents
Culture Documents
• The information on this coversheet will be included in Turnitin’s similarity analysis; however, your lecturers are
aware of this and will disregard it.
Student Details
Student Number 1 0 4 4 9 3 1 4
Unit Details
Manual Submission
If handing in an assignment in a paper or other physical form, sign here to indicate that you have read this form, filled it in
completely and that you certify as above.
Electronic Submission
OR, if submitting this paper electronically as per instructions for the unit, place an ‘X’ in the box below to
indicate that you have read this form and filled it in completely and that you certify as above. Please
include this page with your submission. Any responses to this submission will be sent to your ECU
email address.
21/May/2018
Agreement select check box Date
For procedures and penalties on late assignments please refer to the University Admission, Enrolment and Academic Progress
Rules - rule 24, and the ECU Course and Unit Delivery and Assessment Policy
The information on this coversheet will be included in Turnitin’s similarity analysis; however, your lecturers
are aware of this and will disregard it.
The ECU English Language Proficiency Measure (Feb 2014)
Levels of proficiency Low proficiency Developing Moderate proficiency High proficiency
proficiency
Incorrect or inappropriate Aspects of writing are Aspects of writing are
aspects of writing Incorrect or inappropriate mostly accurate. appropriate and
Aspects of writing obscure meaning in aspects of writing Mistakes rarely affect optimally constructed,
(Indicate with an X main area(s) many places. obscure meaning in clarity of meaning. allowing clarity of
needing improvement) some places. Minor editing needed to meaning.
Significant editing needed clarify the meaning, Meaning is clear and
to clarify the meaning, Some editing needed to along with careful needs only a light
along with extensive clarify the meaning, proofreading to correct proofread to correct
proofreading to correct along with extensive technical errors.
proofreading to correct technical errors.
technical errors.
technical errors.
Sentence structure
1. sentence completeness
2. sentence length
3. phrase/clause order
4. use of conjunctions
5. word order
6. punctuation
Word use
7. word choice
8. word form
9. word omission/redundancy
11. spelling
12. apostrophes
1. Sentence completeness: sentence includes subject, verb a 7. Word choice: words are correct and appropriate for
complete thought. the context.
2. Sentence length: length is appropriate to context or 8. Word form: correct part of speech is used, e.g., [to]
disciple affect / [the] effect.
9. Word omission/redundancy: words should not be
3. Phrase/clause order: parts of the sentence (phrases and
missing or be unnecessarily repetitive.
clauses) are ordered logically.
10. Verb tense/agreement: correct use of verbs that
4. Use of conjunctions: linking words are used correctly to
indicate time and correct word forms that agree
show the relationship between ideas.
grammatically with other words in the sentence.
5. Word order: words are ordered correctly in a sentence.
11. Spelling: correct spelling is used.
6. Punctuation: the correct use of full stops, commas,
12. Apostrophes: indicate ownership or contraction.
semicolons, colons and capitals.
STRUCTURAL TESTING
Assessment 01
Minor Assessment 02
Table of Contents
Question 01: Basic block (A - L) within the program .................................................................2
a) List of all the def-use pairs .............................................................................................2
(i) Code: ..........................................................................................................................2
(ii) Def-use pairs: .............................................................................................................2
(iii) Data Flow Chart: ......................................................................................................3
b) Test suite ........................................................................................................................4
(i) All-defs coverage:.......................................................................................................4
(ii) All-uses coverage: ......................................................................................................6
2.1. Test Suite for All-def coverage and All-use coverage ..........................................8
2.1.1. For variable “n”.............................................................................................8
2.1.2. For variable “key” .........................................................................................8
2.1.3. For variable “mid”.........................................................................................9
2.1.4. For variable “low” and “high”.....................................................................11
2.1.5. For variable “found” ...................................................................................11
(iii) All-du-path coverage: ............................................................................................12
3.1. Test Suite for All-du-path coverage ...................................................................14
3.1.1. For variable “low” .......................................................................................14
3.1.2. For variable “high” ......................................................................................14
3.1.3. For variable “found” ...................................................................................15
Question 02: Using the program code .....................................................................................16
(i) Control Flow Graph ..................................................................................................16
(ii) Test suite that achieves branch coverage ...............................................................17
(iii) List of the set of basis path ....................................................................................18
(iv) Test case using the basic path ...............................................................................18
List of Figures
Figure 1: Data Flow Chart ..........................................................................................................3
Figure 2: Control Flow Chart ....................................................................................................16
List of Tables
Table 1: Def-use pairs ................................................................................................................2
Table 2: All-def coverage table ..................................................................................................5
Table 3: All uses coverage table.................................................................................................7
Table 4: All-du-path coverage table.........................................................................................13
Table 5: Branch Coverage Test Suite .......................................................................................17
Table 6: Test case for basis path ..............................................................................................18
10449314 Page |1
CSI3105 SOFTWARE TESTING – Minor 02
(i) Code:
10449314 Page |2
CSI3105 SOFTWARE TESTING – Minor 02
10449314 Page |3
CSI3105 SOFTWARE TESTING – Minor 02
b) Test suite
Test suite is a collection of test cases that is intended to test specified set of behaviors
of a program and also known as validation suite. It often contains goal for each
collection of test cases and occasionally test suites are used to group similar test cases
together.
(i) All-defs coverage:
In this criteria, for each variable x has a global definition in a node i, a complete
path should be selected which includes a def-clear path from node i to node j that
has a global c-use (node) of variable x or a p-use (edge) of variable x.
Note: I am assuming the while loop only iterates once when selecting test paths in
data flow testing.
10449314 Page |4
CSI3105 SOFTWARE TESTING – Minor 02
(2,9)
1 9
14 ~((high >= low) && (1 – 2 – 9)
found = -1 return found
(found == -1))
(2,3) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
1
15 found - ((high >= low) &&
found = -1
(found == -1))
(1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
(2,9)
4 9
16 ~((high >= low) && (1 – 2 – 3 – 4 – 8 – 2 – 9)
found = mid return found
(found == -1))
(3,4)
(arr-list[mid] == key
3 (1 – 2 – 3 – 4 – 8 – 2 – 9)
17 1
mid = (low + high) / 2
(3,5) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
~(arr-list[mid] == key
(3,5)
3 ~(arr-list[mid] == key)
mid 6
18 mid = (low + high) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
high = mid - 1
/2 (5,6)
(arr-list[mid] > key)
(3,5)
3 ~(arr-list[mid] == key)
7
19 mid = (low + high) (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
low = mid + 1
/2 (5,7)
~(arr-list[mid] > key)
Table 2: All-def coverage table
10449314 Page |5
CSI3105 SOFTWARE TESTING – Minor 02
(3,5) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
02 1 -
arr-list[] ~(arr-list[mid] == key) (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
- (5,6)
03 1 (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
(arr-list[mid] > key)
(5,7)
04 1 - (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
~(arr-list[mid] > key)
1
05 n 1 - (1 – 2 – 9)
high = n - 1
(3,4)
06 1 - (1 – 2 – 3 – 4 – 8 – 2 – 9)
(arr-list[mid] == key)
(3,5) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
07 1 -
~(arr-list[mid] == key) (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
key
(5,6)
08 1 - (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
(arr-list[mid] > key)
(5,7)
09 1 - (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
~(arr-list[mid] > key)
(2,9)
1
10 - ~((high >= low) && (1 – 2 – 9)
low = 0
(found == -1))
(2,3) (1 – 2 – 3 – 4 – 8 – 2 – 9)
low 1
11 - ((high >= low) &&
low = 0
(found == -1))
(1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
1 3 (1 – 2 – 3 – 4 – 8 – 2 – 9)
12 -
low = 0 mid = (low + high) / 2 (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
(2,9)
1
13 - ~((high >= low) && (1 – 2 – 9)
high = n - 1
(found == -1))
(2,3) (1 – 2 – 3 – 4 – 8 – 2 – 9)
1
14 high - ((high >= low) &&
high = n - 1
(found == -1))
(1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
1 3 (1 – 2 – 3 – 4 – 8 – 2 – 9)
15 -
high = n - 1 mid = (low + high) / 2 (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
1 9
16 found - (1 – 2 – 9)
found = -1 return found
10449314 Page |6
CSI3105 SOFTWARE TESTING – Minor 02
(2,9)
1
17 - ~((high >= low) && (1 – 2 – 9)
found = -1
(found == -1))
(2,3) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
1
20 - ((high >= low) &&
found = -1
(found == -1))
(1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
4 9
21 - (1 – 2 – 3 – 4 – 8 – 2 – 9)
found = mid return found
(1 – 2 – 3 – 4 – 8 – 2 – 9)
3
22 1 - (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
mid = (low + high) / 2
(1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
(3,4)
23 1 - (1 – 2 – 3 – 4 – 8 – 2 – 9)
(arr-list[mid] == key
(3,5)
24 1 - (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
~(arr-list[mid] == key
3
4
25 mid = (low + high) - (1 – 2 – 3 – 4 – 8 – 2 – 9)
found = mid
/2
3
(3,4)
26 mid = (low + high) - (1 – 2 – 3 – 4 – 8 – 2 – 9)
(arr-list[mid] == key
/2
mid 3
6
27 mid = (low + high) - (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
high = mid - 1
/2
3
(3,5)
28 mid = (low + high) - (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
~(arr-list[mid] == key)
/2
3
(5,6)
29 mid = (low + high) - (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
(arr-list[mid] > key)
/2
3
7
30 mid = (low + high) - (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
low = mid + 1
/2
3
(5,7)
31 mid = (low + high) - (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
~(arr-list[mid] > key)
/2
Table 3: All uses coverage table
10449314 Page |7
CSI3105 SOFTWARE TESTING – Minor 02
10449314 Page |8
CSI3105 SOFTWARE TESTING – Minor 02
10449314 Page |9
CSI3105 SOFTWARE TESTING – Minor 02
C-2 (3,5)
Covered P-use
~(arr-list[mid] == key)
Def-Clear Path (1 – 2 – 3 – 5 – 6)
Complete Path (1 – 2(T) – 3(F) – 5(T) – 6 – 8 – 2(F) – 9)
Input Expected Output
arr-list[]={0,2,4,7} -1
n=2
key = -1
(3,5)
Covered P-use
C-3 ~(arr-list[mid] == key)
Def-Clear Path (1 – 2 – 3 – 5 – 7)
Complete Path (1 – 2(T) – 3(F) – 5(F) – 7 – 8 – 2(F) – 9)
Input Expected Output
arr-list[]={2,8,10,12} -1
n=1
key = 10
10449314 P a g e | 10
CSI3105 SOFTWARE TESTING – Minor 02
10449314 P a g e | 11
CSI3105 SOFTWARE TESTING – Minor 02
10449314 P a g e | 12
CSI3105 SOFTWARE TESTING – Minor 02
(2,9)
1 9
16 ~((high >= low) && (1 – 2 – 9)
found = -1 return found
(found == -1))
(2,3) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
1 4
17 ((high >= low) && (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
found = -1 found = mid
(found == -1)) (1 – 2 – 3 – 4 – 8 – 2 – 9)
found
(2,9)
4 4
18 ~((high >= low) && (1 – 2 – 3 – 4 – 8 – 2 – 9)
found = mid found = mid
(found == -1))
(2,9)
4 9
19 ~((high >= low) && (1 – 2 – 3 – 4 – 8 – 2 – 9)
found = mid return found
(found == -1))
(3,4)
(arr-list[mid] == key (1 – 2 – 3 – 4 – 8 – 2 – 9)
3
20 1
mid = (low + high) / 2
(3,5) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
~(arr-list[mid] == key
3 4 (3,4)
21 mid = (low + high) (1 – 2 – 3 – 4 – 8 – 2 – 9)
found = mid (arr-list[mid] == key
/2
mid (3,5)
3 ~(arr-list[mid] == key)
6
22 mid = (low + high) (1 – 2 – 3 – 5 – 6 – 8 – 2 – 9)
high = mid - 1
/2 (5,6)
(arr-list[mid] > key)
(3,5)
3 ~(arr-list[mid] == key)
7
23 mid = (low + high) (1 – 2 – 3 – 5 – 7 – 8 – 2 – 9)
low = mid + 1
/2 (5,7)
~(arr-list[mid] > key)
Table 4: All-du-path coverage table
10449314 P a g e | 13
CSI3105 SOFTWARE TESTING – Minor 02
The following test suite for all-du-path coverage will include the paths with c-uses that has
def-clear simple path and p-uses that has a def-clear loop free path. The paths with def-clear
path in all-du-path coverage is already covered in the above given test suite.
10449314 P a g e | 14
CSI3105 SOFTWARE TESTING – Minor 02
10449314 P a g e | 15
CSI3105 SOFTWARE TESTING – Minor 02
10449314 P a g e | 16
CSI3105 SOFTWARE TESTING – Minor 02
T – True
F – False
P1 = [ A – B (F) – L ]
P2 = [ A – B (T) – C (T) – D – E (T) – G – B (T) – C (F) – L ]
P3 = [ A – B (T) – C (T) – D – E (F) – H (T) – J – B (F) – L ]
P4 = [ A – B (T) – C (T) – D – E (F) – H (F) – K – B (T) – L ]
10449314 P a g e | 17
CSI3105 SOFTWARE TESTING – Minor 02
There are two ways you can find the cyclomatic complexity:
Cyclomatic complexity = the number of regions + 1 OR the number of predicates + 1
In this CFG, the number of predicates is equal to 4 and regions is equal to 4
therefore 4 + 1 is equal to 5 paths
P1 = [ A – B (F) – L ]
P2 = [ A – B (T) – C (F) – L ]
P3 = [ A – B (T) – C (T) – D – E (T) – G – B (F) – L ]
P4 = [ A – B (T) – C (T) – D – E (F) – H (T) – J – B (F) – L ]
P5 = [ A – B (T) – C (T) – D – E (F) – H (F) – K – B (F) – L ]
Total: 5 Paths
• Path 02 is infeasible because without entering the while loop, the variable “found” is
always equal to -1
10449314 P a g e | 18