Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Release date: Tuesday, 26.06.12 - Due date: Monday, 03.07.12, 23:59
4 points |
---|
Decide whether the following statements are correct or wrong. Give the answer and a short explanation (1-2 sentences) in a text file.
Evaluation: For this assignment you get 0,5 points for every correct answer with a reasonable explanation. During the final exam you get +1 point for every correct answer and -1 point for every incorrect answer. The minimal number of points for each of the section is 0, this means e.g. giving three incorrect answers in the first block does not influence the points for the second block.
Correct | Wrong | Statement | |
---|---|---|---|
Black box testing makes use of equivalence classes and the tests should always be written by the programmers themselves, because they know best what is inside the black box. | |||
Evaluation scenarios gathered during requirements elicitation are meant to be a basis for client acceptance tests. | |||
If you can get full statement coverage for a method, you can also get full branch coverage for this method. | |||
If a method contains 8 if-statements (and no other conditionals), you might need 256 test cases to achieve full path coverage, but not more than 9 test cases to achieve full basis path coverage. | |||
Correct | Wrong | Statement | |
The Bottom-up testing strategy employs stubs to simulate components. | |||
Expected results are sometimes called Test Oracle. | |||
The cyclomatic complexity metric provides the number of test cases needed for the basis path test coverage. | |||
Mocks simulate components that are called by the tested component and check expected behavior. |
6 points |
---|
Given is the following method sort which sorts a field of int variables with a bubble sort.
<code java|h The Sort Method> public int[] sort(int[] list) { Nr. boolean change = true; 1
if (list.length > 1) { // 2 while (change) { // 3 change = false; // 4 for (int i = list.length - 1; // 5 i > 0; // 6 i--) { // 7 int i1 = list[i]; // 8 int i2 = list[i – 1]; // 9 if (i1 < i2) { // 10 list[i] = i2; // 11 list[i – 1] = i1; // 12 change = true; // 13 } } } } return list; // 14
} </Code>
4 points |
---|
This is a variation of the self-assessment from the classical book from Glenford J. Myers “The Art of Software Testing”.
Your task it to enumerate meaningful equivalence classes with representative test data and expected results for a method specified as follows:
[A method has three integer parameters representing] the lengths of the sides of a triangle. The [method returns a code] that states whether the triangle is scalene1), isosceles2), or equilateral3). |
---|
(As this specification only allows integers for the side lengths, you might guess that this author has a more elementary understanding of triangles. So, don't expect this author to consider triangles that just consist of one point to be triangles.)
If you find concrete code helpful, you may have a look at the following: <code java|h Interface for a class implementing this function|h> package triangles;
import static triangles.TriangleKnowledge.TriangleKind.*;
public class TriangleKnowledge {
/** * For the definitions of the different kinds of triangles you may consult * for example http://en.wikipedia.org/wiki/Triangle#Types_of_triangle */ public static enum TriangleKind { EQUILATERAL, EQUIANGULAR, SCALENE, ISOSCELES, OBLIQUE, ACUTE, OBTUSE, RIGHT_ANGLED, NOT_A_TRIANGLE }
public boolean isTriangleOfKind(int a, int b, int c, TriangleKind kind) { return false; }
/** * Returns the most specific triangle kind based on the lengths of the * sides. Possible values are: EQUILATERAL, SCALENE, ISOSCELES, * NOT_A_TRIANGLE */ public static TriangleKind kindOfTriangleByLengthsOfSides(int a, int b, int c) { return null; }
/** * Returns the most specific triangle kind based on the internal angles. * Possible values are: EQUIANGULAR, OBLIQUE, ACUTE, OBTUSE, RIGHT_ANGLED, * NOT_A_TRIANGLE */ public static TriangleKind kindOfTriangleByInternalAngles(int a, int b, int c) { return null; }
} </Code>
If you like to practice Test-First development, you may try to implement kindOfTriangleByLengthsOfSides
Test-First (for additional 2 points ). This method is much easier than the contains method from the previous assignment and therefore a better candidate for a first experiment in Test-First.
4 points |
---|
In this task we revisit Task 04 of Assignment 10 from the perspective of systematic Black-Box testing. It is again about testing the contains
method. Even if you did not manage to identify the correct implementation during the last assignment, it might be worth to try it again.