1 / 14

Übung zu Software Engineering

Übung zu Software Engineering. Testen. Klausur. Termin: 15.02.2006, 11 00 -13 15 Uhr Ort: WI SE I: Sch 6 (Scharnhorststr. 103-109) SE II: AVZ (Robert-Koch-Str. 28) Geoinformatik (24) , Informatik (21) , Lehramt (3) , Mathematik (2) Sch 5 (Scharnhorstr. 121). Black-Box-Tests.

len-vincent
Download Presentation

Übung zu Software Engineering

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Übung zu Software Engineering Testen

  2. Klausur • Termin: 15.02.2006, 1100-1315 Uhr • Ort: • WI • SE I: Sch 6 (Scharnhorststr. 103-109) • SE II: AVZ (Robert-Koch-Str. 28) • Geoinformatik (24), Informatik (21), Lehramt (3), Mathematik (2) • Sch 5 (Scharnhorstr. 121)

  3. Black-Box-Tests • Verhalten von größterTeiler(Brett b) abhängig von Längen der beiden Bretter • Liggesmeyer: „Falls Grund zur Annahme besteht, dass Elemente einerÄquivalenzklasse unterschiedliche behandelt werden, so ist die Äquivalenzklasse entsprechend aufzuteilen.“ • Aquivalenzklassen: • Länge eines/beider Brettes/r =0 (<0) • Brett 1 teilt Brett 2 ohne Rest • Brett 1 teilt Brett 2 mit Rest • GGT ist 1 • Gleich lange Bretter • Kein Brett übergeben (0, 2,) (2, 0, )(0, 0, )(-4, 2, ) (2, -4, )(-4, -4, ) (9, 3, 3) (3, 9, 3) (4, 6, 2) (6, 4, 2) (3, 8, 1) (8, 3, 1) (5, 5, 5) (5, null, )

  4. „normale“ Ausnahmebedingung muss deklariert werden sollte vom Programm behandelt werden schwere Ausnahme muss nicht definiert werden in der Regel nicht behandelbar NullPointerException AssertionError Java-„Exceptions“ Throwable Exception Error

  5. def-use-Ketten public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  6. def-use-Ketten public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  7. def-use-Ketten Test 1: länge = 0; b.länge = 1  AssertionError public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  8. def-use-Ketten Test 2: länge = 1; b.länge = 0  AssertionError public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  9. def-use-Ketten Test 3: länge = 1; b = null  0 public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  10. def-use-Ketten Test 4: länge = 8; b.länge = 6  2 (2 Schleifendurchläufe, erst beim 2. Durchlauf in „if“) public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  11. def-use-Ketten Test 5: länge = 6; b.länge = 8  2 (2 Schleifendurchläufe, auch beim 1. Durchlauf in „if“) public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  12. def-use-Ketten Test 6: länge = 2; b.länge = 2  2 (1 Schleifendurchlauf ohne „if“) public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  13. def-use-Ketten def-use-Kette 12 nicht realisierbar (x mod y < y) public int größterTeiler(Brett b){ int x, y; try{ x = länge; y = b.länge; assert x > 0 : "Länge muss größer als 0 sein. (" + x + ")"; assert y > 0 : "Länge muss größer als 0 sein. (" + y + ")"; while (x > 0){ if (x < y){ int t = x; x = y; y = t; } x %= y; } } catch (Exception e){ y = 0; } return y; } 1 [b; <init>; y = b.länge] 2 [x; x = länge; assert x > 0] 3 [x; x = länge; „Länge…“+x; 4 [x; x = länge; while (x > 0)] 5 [x; x = länge; if (x<y)] 6 [x; x = länge; int t = x] 7 [x; x = länge; x %= y] 8 [x; x = y; x %= y] 9 [x; x %= y; while (x > 0)] 10 [x; x %= y; if (x < y)] 11 [x; x %= y; int t = x] 12 [x; x %= y; x %= y] 13 [y; y = b.länge; assert y > 0] 14 [y; y = b.länge; „Länge…“+y; 15 [y; y = b.länge; if (x < y)] 16 [y; y = b.länge; x = y] 17 [y; y = b.länge; x %= y] 18 [y; y = b.länge; return y] 19 [y; y = t; x %= y] 20 [y; y = t; if (x < y)] 21 [y; y = t; x = y] 22 [y; y = t; return y] 23 [y; y = 0; return y] 24 [t; int t = x; y = t]

  14. JUnit-Tests •  Eclipse

More Related