SWEA 2018 Weekplan 8

The learning goals for Week 43 are:

Mon: (Week 43): Systematic Testing: Equivalence Class Partitioning. Wed: Code Coverage. Dependency Management.



Notes for this weekplan:

There is no delivery of mandatory this week. Spend the time in the Lab on the exercises described in the exercise list; and you are of course also welcome to start working on the exercises for next week's mandatory delivery.

Additional exercises:

FRS exercises

25.2 (Proxy) 34.3 (EC on Breakthrough game (described in exercise 5.4))

Null Objects

The Null Object pattern is a much safer way to encode 'no behavior' than using null pointers.

Review your HotCiv code base for delegates that implement the Null Object pattern. There should be plenty!

Strengthen analyzability of your HotCiv codebase by refactoring/renaming those delegates to indicate that they are indeed nullobjects.

Dependency Management: WordUtils

Apache Commons is a project developing reusable Java units. One of them is WordUtils that contains a number of functions to manipulate strings consisting of words. For instance

    public static void main(String[] args) {
        String  message = "Henrik Bærbak Christensen";
        System.out.println("Name : " + message);
        System.out.println("Initials are: "
                           + WordUtils.initials(message, null));
will output my initials "HBC".

Download the wordutils zip file, and update the build.gradle file with the proper dependency to make the code compile. Use maven repository (mvnrepository.org) to find the proper gradle setting. Test it by running the manual test case ('gradle wordutil').

UPDATE: There is a bug in the build.gradle file: Please replace:
  main = 'Hello'
  main = 'example.Hello'

Note: The solution is a one-liner in the build.gradle file, and thus getting the answer from your friend is not the learning goal. This is an exercise in searching for the right answer on the web - what is the name of the library, what versions exist, what is the dependency information?

Systematic Testing: Triangle problem

Download the triangle project: tri.zip. This is the classic triangle type problem referenced in many testing books:

Given three integers a, b, c, that are taken to be sides of a triangle, determine the type:
  • Equilateral (Ligesidet): All sides are of equal length
  • Isosceles (Ligebenet): Two sides are of equal length, but not the third
  • Scalene (?): All three sides are unequal length
  • NotATriangle: a, b, c, cannot form a triangle (sum of two shortest sides is less than the longest)

You will find a small set of test cases in the test folder, and two implementations. The test cases and one implementation, my own, has been developed using Test-Driven Development.

  1. Do an EC analysis of the triangle problem and generate test cases (without inspiration from my test cases :).
  2. Compare the generated testcases with the ones I made using TDD. Are mine adequate? Are there things you overlooked in your EC analysis?
  3. Jorgensen specifices a variant of the problem: All sides a, b, c, must be in the interval 1..200. Do a boundary value analysis of this variant, and document the additionally generated test cases.
  4. If you like an excuse to avoid spending time with your family and friends : Augment the implementation and test case to handle the Jorgensen variant.

Exam Rehearsal

Rehearse a systematic testing exam situation. Sit down and Spend 25 minutes to prepare a 10 minute oral presentation of an exercise in the example exam question set: demo-question-final-2018.pdf.

Next, do a 10 minute presentation at the whiteboard in front of your team.

The team provides constructive feedback on the presentation: Is your presentation clear and understandable, do you discuss the concepts and terms correctly, is you Java example code correct, etc. Swap and ensure all in the team gets a chance to rehearse the situation.

Legend: The typography bold, normal, (brackets), above indicate my perception of how important the exercises are from high to optional. However, solve the mandatory project first!.