Presentation is loading. Please wait.

Presentation is loading. Please wait.

TESTS. The V cycle Specification Global Design Detailed Design Coding Unit Tests integration Tests Validation V&VV&V.

Similar presentations


Presentation on theme: "TESTS. The V cycle Specification Global Design Detailed Design Coding Unit Tests integration Tests Validation V&VV&V."— Presentation transcript:

1 TESTS

2 The V cycle Specification Global Design Detailed Design Coding Unit Tests integration Tests Validation V&VV&V

3 TESTS LEVELS TECHNIQUES OF TEST DYNAMIC VERIFICATION

4 TESTS LEVELS UNIT TESTS INTEGRATION TESTS SYSTEM TESTS ** VALIDATION ** NON-REGRESSIVE TESTS

5 TECHNIQUES OF TESTS FUNCTIONAL TESTS STRUCTURALS TESTS ERROR - ORIENTED TESTS ROBUSTNESS TESTS PERFORMANCE TESTS

6 TESTS AND ANALYSIS DEFINITION TECHNIQUES OF ANALYSIS TECHNIQUES OF TESTS SELECTION OF RIGHT TECHNIQUES TESTING TOOLS

7 DEFINITION Software testing is the execution of a system or a component using automatic or manual means in order to verify the software fulfils its specifications or identify the differences between the expected results and the observed results "

8 Test Case A test case specify : – the state of the Implementation Under Test (IUT) and its environment before the test – the vector of input variables and the conditions – the expected result messages, exceptions values of output variables the resulting state of the IUT and its environment

9 Example informal Specification : Write a programme which permit to enter the elements of an array, reverse them and display the reversed array.

10 Call graph main() writeArray()reverseArray()displayArray() swap() printf()scanf()

11 Fonction à tester : void swap(int *p1,int *p2) { int aux; aux=*p1; *p1=*p2; *p2=aux; } Jeu de test : /* input vector */ a = 3; b = 4; /* output vector */ ra = 4; rb = 3; Boolean oracle(int r1, int p1, int r2, int p2) { return (r1 == p1 && r2 == p2); }

12 #include #include "definitions.h" Boolean oracle(int rp1, int pp1, int rp2, int pp2); /* function to test */ void swap(int *p1,int *p2); int main() { int a,b,ra,rb; Boolean resultat; resultat = FALSE; /* input vector */ a = 3; b = 4; /* output vector */ ra = 4; rb = 3; swap(&a, &b); resultat = oracle(a,ra,b,rb); printf("resultat = %s\n", (resultat == TRUE) ? "Test OK":"Error"); #if 1 printf( "a = %d b = %d\n",a,b); printf( " ra = %d rb = %d\n",ra,rb); #endif } Boolean oracle(int r1, int p1, int r2, int p2) { return (r1 == p1 && r2 == p2); } void swap(int *p1,int *p2) { int aux; aux=*p1; *p1=*p2; *p2=aux; }

13 Function to test : void reverseArray(int t[]) { int i; for(i=0;i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3836426/slides/slide_13.jpg", "name": "Function to test : void reverseArray(int t[]) { int i; for(i=0;i

14 #include #include "definitions.h" Boolean oracle(int t[], int t1[]); void swap(int *p1,int *p2); /* function to test */ void reverseArray(int t[]); int main() { Boolean resultat = FALSE; /* input vector */ int tab[DIM] ={0,1,2,3,4,5,6}; /* output vector */ int tabInv[DIM] = {6,5,4,3,2,1,0}; reverseArray(tab); resultat = oracle(tabInv, tab); printf("resultat = %s\n", (resultat == TRUE) ? "Test OK":"Error"); } Boolean oracle(int t[], int t1[]) { return (t[0] == t1[0] && t[1] == t1[1] && t[2] == t1[2] && t[3] == t1[3] && t[4] == t1[4] && t[5] == t1[5] && t[6] == t1[6]); } void swap(int *p1,int *p2) { int aux; aux=*p1; *p1=*p2; *p2=aux; } void reverseArray(int t[]) { int i; for(i=0;i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3836426/slides/slide_14.jpg", "name": "#include #include definitions.h Boolean oracle(int t[], int t1[]); void swap(int *p1,int *p2); /* function to test */ void reverseArray(int t[]); int main() { Boolean resultat = FALSE; /* input vector */ int tab[DIM] ={0,1,2,3,4,5,6}; /* output vector */ int tabInv[DIM] = {6,5,4,3,2,1,0}; reverseArray(tab); resultat = oracle(tabInv, tab); printf( resultat = %s\n , (resultat == TRUE) .", "description": "Test OK : Error ); } Boolean oracle(int t[], int t1[]) { return (t[0] == t1[0] && t[1] == t1[1] && t[2] == t1[2] && t[3] == t1[3] && t[4] == t1[4] && t[5] == t1[5] && t[6] == t1[6]); } void swap(int *p1,int *p2) { int aux; aux=*p1; *p1=*p2; *p2=aux; } void reverseArray(int t[]) { int i; for(i=0;i

15 The limitation of testing Input space execution sequences fault sensibility

16 Read 3 integer values. These 3 values represent the length of the sides of a triangle. The programme displays a message which establishes that the triangle is isoceles, équilateral or scalene. If an integer is given in 2 Bytes, it means that there are 6553- possibilities => for 3 integers there are 2,81475E+14 possibilities

17 The execution sequences for (int i=0; i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3836426/slides/slide_17.jpg", "name": "The execution sequences for (int i=0; i

18 The execution sequences for (int i=0; i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3836426/slides/slide_18.jpg", "name": "The execution sequences for (int i=0; i

19 The execution sequences for (int i=0; i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3836426/slides/slide_19.jpg", "name": "The execution sequences for (int i=0; i

20 The execution sequences for (int i=0; i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3836426/slides/slide_20.jpg", "name": "The execution sequences for (int i=0; i

21 The execution sequences

22 Fault sensibility int scale(short j) { j = j -1; // should be j = j+1 j = j/30000; return j; } We suppose that a short integer is coded in 2 bytes (16 bits)

23 Other limitations To Test a programme permits to show that there are faults but not their absence The tests based on an implementation cannot reveal omissions because the absent code cannot be tested One can never be sure that a test system is without any error.

24 Testing, Why? Missing functionalities Wrong functionalities Side effects, not wanted interactions bad performances, real time problems, deadlock… Wrong outputs

25 Designing for Testing lire I,J; débutCas cas I = 5 et J < 4 alors M = 23; cas I = 5 et J >= 4 alors M = J + 16; cas (J + 1) < I et I<0 alors M = 4I +J; cas (J + 1) = 0 et I /= 5 alors M = 5I + 2 cas (J + 1) >= I et J < 2 alors M = 2I + 3J - 4; cas (J + 1) >= I et J>= 2 et I /= 5 alors M = 3I +2J –2; finCas écrire M; lire I,J; si I <= J + 1 alorsK = I + J -1 sinonK = 2I + 1 finsi si K >= I+1 alorsL = I + 1 sinonL = J - 1 finsi si I = 5 alors M = 2L + K sinonM = L + 2K - 1 finsi écrire M;

26 Read 3 integer values. These 3 values represent the length of the sides of a triangle. The programme displays a message which establishes that the triangle is isoceles, équilateral or scalene.

27 Classes of equivalence 8 valid Classes – scalele triangle – isoceles triangle (4) – équilateral (2) 25 non valid Classes – 1 value = 0 – 3 values = 0 – 1 negative value – flat isoceles triangle – 3 values such that the sum of 2 of them < to the third (6) – 1 non numeric value (3) – 1 missing value (3) – flat scalene triangle – 1 max value

28 from cause to effect Graph Principe : showing the specification as a graph – One define the inputs and outputs – One build the graph by means of logic connectors (and, or, non) Example : Be the following specification: – Any vehicule identifier must begin by the A, B or C character and having as 2nd character a X. the messages M1 and M2 are provided respectively in case of error on the first or the second character. If the identifier is right, it is put in a database.

29 from cause to effect Graph V V E1 E2 E3 E4 S2 S3 S1

30 Activity Diagram WRITE DB MESSAGE M2 X X [1st CHARACTER == A] WRITE DB MESSAGE M2 X X [1st CHARACTER == B] WRITE DB MESSAGE M2 X X [1st CHARACTER == C] MESSAGE M1 [1st CHARACTER ! = ….]

31 The Test in Object Oriented Programming Class level – test of methods “designing for testing” control graph data flow graph – test of sequences of methods activation states transitions diagramme – test of inherited methods classe diagramme

32 Read 3 integer values. These 3 values represent the length of the sides of a triangle. The programme displays a message which establishes that the triangle is isoceles, équilateral or scalene.

33 A test about Testing Procedural programming – 33 cases of test Objet Oriented Programming – 58 cases of test (26 are commun to those above,, 32 are due to the OOP)

34 FIGURE OUVERTE FERMEE SEGMENT MULTI-SEG ELLIPSE CIRCLE POLYGONE TRIANGLE QUADRILATERE…..

35 TRIANGLE SEGMENT POINT

36 Control Graph for (int i=0; i { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3836426/slides/slide_36.jpg", "name": "Control Graph for (int i=0; i

37 Figure: State Machine diagram of class Client test of sequences of methods activation

38 The Test in Object Oriented Programming Subsystem Level – test of associations, aggregations (class diagram) multiplicity creation, deletion – test of sequences (sequence diagram ) building of a flow graph – test of controlled exceptions

39 Sub-System Level Triangle Segment Mediatheque Document FicheEmprunt concern 1..*

40 Sequence Diagram leLecteurDeCarteuneSessionl_EcranleClavieruneBanque debuteSession [pasCarteCrédit]eject afficheDemandeCode recupèreLeCode contrôleCarte [estVolée]garde

41 Flow Graph debuteSession garde [pasCarteCrédit]éjecte afficheDemandeCode recupèreLeCode contrôleCarte [estVolée]

42 The Test in Object Oriented Programming Integration Tests (class diagram => dependance tree- inheritance diagram) Techniques – big-bang – bottom-up – top-down

43 The Test in Object Oriented Programming Application Level (Uses cases)

44 The Test in Object Oriented Programming The interaction of methods (individually right) of classes et sub-classes could generate errors => These interactions must be systematically tried

45 The Test in Object Oriented Programming Omitting the overloading of a method of a super class situated very hight in the hierarchy graph is easy => The test designed for the super classes must be re-executed on each of the sub-classes et designed to be re-used in order to test any of the sub classes

46 The Test in Object Oriented Programming The difficulty and complexity of implementing constraints of multiplicity could very easily lead to errorswhen an element is, added, up to dated, deleted. => The implementation of multiplicity should be systematically tried

47 The Test in Object Oriented Programming Classes with séquential constraints on methods activation and their clients could have sequencement errors => The required behaviourshould be tested using a model of state machine.


Download ppt "TESTS. The V cycle Specification Global Design Detailed Design Coding Unit Tests integration Tests Validation V&VV&V."

Similar presentations


Ads by Google