King¡¯s College London
This paper is part of an examination of the College counting toward the award of a degree. Examinations are governed by the College Regulations under the authority of the Academic Board.
Degree Programmes
Module Code Module Title Examination Period
BSc, MSci
6CCS3SMT
Software Measurement and Testing January 2015 (Period 1)
Time Allowed 2 hours
Rubric ANSWER ALL THREE QUESTIONS.
Books, notes or other written material may not be brought into this examination.
ANSWER EACH QUESTION IN A SEPARATE ANSWER BOOK AND WRITE ITS NUMBER ON THE COVER
Calculators Calculators may be used. The following models are permitted: Casio fx83 / Casio fx85
PLEASE DO NOT REMOVE THIS PAPER FROM THE EXAMINATION ROOM
King¡¯s’College’London’ý’2015′ ‘
!
6CCS3SMT Software Measurement and Testing
Question 1 Part A
Why are there different measurement scale types? Name three scale types and give one example for each type. (2 marks for each example)
[6 marks]
Part B
Define cyclomatic complexity. Is it the same as the number of paths in the graph? If yes, explain. If no, give an example demonstrating the difference.
[7 marks]
Part C
(a) Give definitions of white box testing and black box testing. (4 marks)
(b) Write an example (in pseudo-code) where black box testing misses a fault in the program. Explain your example. (4 marks)
(c) Explain how white box testing can catch the fault in your example from (b). (4 marks)
(d) Give the definition of an appropriate coverage criterion for your test suite that ensures that the fault is caught. (4 marks)
(e) Give a minimal testing suite that has 100% coverage of the criterion
in (d).
(4 marks)
[20 marks]
2!
SEE NEXT PAGE
6CCS3SMT Software Measurement and Testing
!
Question 2 Part A
(a) Give the definition of structural testing. Name and describe two coverage criteria suitable for structural testing. (5 marks)
(b) Give the definition of functional testing. Name and describe two coverage criteria suitable for functional testing. (5 marks)
(c) Give the definition of stress testing. Where is it used and why? (5 marks)
(d) Give the definition of mutation analysis. What are mutants? What does it mean when a mutant is distinguished from the original? Give one coverage criterion for mutation analysis. (5 marks)
[20 marks]
Part B
(a) Give the definition of an invariant property. Write a formal specification in linear temporal logic for the invariant of (x>0). Are counterexamples to invariant properties finite or infinite? Draw a counterexample (finite or infinite with a loop, depending on your answer) to this invariant property. (7 marks)
(b) Write a formal specification in linear temporal logic for the property
¦× =¡°there exists a point starting from which x is always greater than 0¡±. Draw an infinite execution (with a loop) that satisfies this property and an infinite execution (with a loop) that is a counterexample.
(7 marks)
[14 marks]
3!
SEE NEXT PAGE
6CCS3SMT Software Measurement and Testing
!
Question 3
Natural language requirements for a microwave require the following:
1. When the start button is pushed and the door is closed, the
microwave heats the food inside for 1 minute.
2. Pushing the start button while heating has no effect.
3. Pushing the start button if the door is open has no effect.
4. Pushing the start button when there is no food inside has no
effect.
5. After heating, the food is hot (you can assume this is a final state).
Part A
Draw a Finite State Machine (FSM) that is a reference model for the microwave.
[14 marks]
Part B
Give two possible coverage criteria for model-based testing.
[5 marks]
Part C
Write a minimal testing suite with 100% coverage (according to one of the criteria you specified in Part B) for the microwave.
[14 marks]
4!
S E E N EFXI NT APLA GP AE G E !