1 / 119

Funkcinis testavimas

Funkcinis testavimas. Programų testavimas remiantis įėjimo, išėjimo ir vidinių būsenų kintamaisiais. Testavimo atvejai. Testavimo duomenys. Testavimo rezultatai. Testavimo ataskaitos. Suprojektuoti testavimo atvejus. Pa ruošti testavimo duomenis. Paleisti programą su test. duom.

Télécharger la présentation

Funkcinis testavimas

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. Funkcinis testavimas • Programų testavimas remiantis įėjimo, išėjimo ir vidinių būsenų kintamaisiais.

  2. Testavimo atvejai Testavimo duomenys Testavimo rezultatai Testavimo ataskaitos Suprojektuoti testavimo atvejus Paruošti testavimo duomenis Paleisti programą su test. duom. Palyginti rezultatus su testavimo atvejais Defektų testavimo procesas

  3. “Juodos dėžės “ testavimas • Testavimo metodas, kai programa yra įsivaizduojama kaip “juoda dėžė”. • Programos testavimo atvejai yra paremti sistemos specifikacija. • Testo planavimas gali prasidėti labai anksti programinės įrangos kūrimo procese.

  4. Funkcinė specifikacija • Sąsajos ekranas ir vykdoma užduotis • Paprastai pagal funkcinę specifikaciją testuoja ne programos realizuotojas • Geriausiai tinka nepriklausomiems fragmentams • Susietiems fragmentams turi įtaką vykdymo tvarka

  5. Vidinės būsenos • Kiekvienas automatas remiasi perėjimais tarp būsenų • Testavimo metu turi būti nagrinėjami visi perėjimai tarp būsenų • Būsenų gali būti labai daug

  6. B01 • architecture BEHAV of b01 is • constant a:integer:=0; • constant b:integer:=1; • constant c:integer:=2; • constant e:integer:=3; • constant f:integer:=4; • constant g:integer:=5; • constant wf0:integer:=6; • constant wf1:integer:=7;

  7. B01 • when a => • if line1='1' and line2='1' then • stato:=f; • else • stato:=b ; • end if; • outp <= line1 xor line2; • overflw <= '0' ;

  8. F G 1 E A B C 0 Perėjimų tarp būsenų grafas

  9. Įvedimas, sukeliantis nenormalų elgesį. Įvesti testavimo duomenys I Sistema Išvedimai, kurie parodo defektų buvimą. Įšvesti testavimo rezultatai O “Juodos dėžės “ testavimas e e

  10. Ekvivalentinis dalinimas • Įvedami duomenys ir išvedami rezultatai dažnai paskirstomi į atskiras klases, kur visi klasių nariai yra susieti. • Kiekviena iš šių klasių yra lygiaverčio suskirstymo rezultatas, kur programos elgesys su kiekvienu klasės nariu yra toks pats (ekvivalentiškas). • Testiniai atvejai turi būti pasirinkti iš kiekvienos dalies.

  11. Teisingos įvestys Neteisingosįvestys Sistema Išvestys Ekvivalentinis dalinimas

  12. Ekvivalentinis dalinimas • Padalinti sistemos įėjimų ir išėjimų reikšmes į “ekvivalentiškas aibes”. • Jei įvedamas -5 skaitmenų sveikas skaičius tarp 10000 ir 99999, ekvivalentinis padalinimas yra <10000, 10000-99999 ir > 99999. • Išrinkti testinius atvejus ribose šių aibių 0000, 09999, 10000, 99999, 100000.

  13. 3 1 1 4 7 1 0 Mažiau nei 4 Tarp 4 ir 10 Daugiau nei 10 Įvedimų reikšmių skaičius 9999 100000 10000 50000 99999 Mažiau nei 10000 Tarp 10000 ir 99999 Daugiau nei 99999 Įvedamos reikšmės Ekvivalentinis padalinimas

  14. Paieškos procedūros specifikacija procedure Search (Key : ELEM ; T: ELEM_ARRAY; Found : in out BOOLEAN; L: in out ELEM_INDEX) ; Pre-condition -- the array has at least one element T’FIRST <= T’LAST Post-condition -- the element is found and is referenced by L ( Found and T (L) = Key) or -- the element is not in the array ( not Found and not (exists i, T’FIRST >= i <= T’LAST, T (i) = Key ))

  15. Įėjimo poveikių padalinimas paieškos procedūrai • Išskiriami įėjimo poveikiai (įvestis), kurie atitinka išankstines sąlygas. • Išskiriami įėjimo poveikiai, kur išankstinės sąlygos nėra palaikomos. • Įėjimo poveikis, kur nurodytas elementas yra masyvo narys. • Įėjimo poveikis, kur pagrindinis elementas nėra masyvo narys.

  16. Testavimo nuorodos masyvams • Testuoti programinę įrangą kai masyvas turi tik vieną elementą. • Skirtingiems testams naudoti skirtingo dydžio masyvus. • Parinkti testus taip, kad būtų nagrinėjamas pirmas, vidurinis ir paskutinis masyvo elementas. • Testuoti nulinio ilgio masyvus.

  17. Testai paieškos procedūrai

  18. Binary search (Java)

  19. Ekvivalentinis sudalinimas dvejetainei paieškai • Patenkintos išankstinės sąlygos, pagrindinis elementas masyve. • Patenkintos išankstinės sąlygos, pagrindinio elemento nėra masyve. • Nepatenkintos išankstinės sąlygos, pagrindinis elementas masyve. • Nepatenkintos išankstinės sąlygos, pagrindinio elemento nėra masyve. • Įėjimo masyvas turi vienintelę reikšmę. • Įėjimo masyvas turi lyginį reikšmių skaičių. • Įėjimo masyvas turi nelyginį reikšmių skaičių.

  20. Ekvivalentinių klasių ribiniai atvejai

  21. Dvejetainės paieškos testiniai atvejai

  22. Functional TestingSpecification Based Testing (Black Box testing) 22

  23. Why do it? • Increase our confidence that the software works and works correctly

  24. Devise a test plan A program reads 3 integer values. The 3 values are interpreted as representing the lengths of the sides of a triangle. The program prints a message that states whether the triangle is scalene ( nelygiašonis), isosceles (lygiašonis), orequilateral (lygiakraštis). Write test cases that would adequately test this program.

  25. Myers Test Cases • 1. Valid scalene (5, 3, 4) => scalene • 2. Valid isoscleles (3, 3, 4) => isosceles • 3. Valid equilateral (3, 3, 3,) => equilateral • 4. First permutation of 2 sides (50, 50, 25) => isosceles • 5. Second perm of 2 sides (25, 50, 50) => isosceles • 6. Third perm of 2 sides (50, 25, 50) => isosceles • 7. One side zero (1000, 1000, 0) => invalid

  26. More test cases • 8. One side has negative length (3, 3, -4) => invalid • 9. first perm of two equal sides (5, 5, 10) => invalid • 10. Second perm of 2 equal sides (10, 5, 5) => invalid • 11. Third perm of 2 equal sides (5, 10, 5) => invalid • 12. Three sides >0, sum of 2 smallest < largest (8,2,5) => invalid • 13. Perm 2 of line lengths in test 12 (2, 5, 8) => invalid • 14. Perm 3 of line lengths in test 12 (2, 8, 5) => invalid

  27. More test cases • 15. Perm 4 of line lengths in test 12 (8, 5, 2) => inv • 16. Perm 5 of line lengths in test 12 (5, 8, 2) => inv • 17. Perm 6 of line lengths in test 12 (5, 2, 8) => inv • 18. All sides zero (0, 0, 0) => inv • 19. Non-integer input, side a (@, 4, 5) => inv • 20. Non-integer input, side b (3, $, 5) => inv • 21. Non-integer input, side c (3, 4, %) => inv

  28. More test cases • 22. Missing input a (, 4, 5) => invalid • 23. Missing input b (3, , 5) => invalid • 24. Missing input c (3, 4, ) => invalid • 25. Three sides > 0, one side equals the sum of the other two (12, 5, 7) => inv • 26. Perm 2 of line lengths in test 25 (12, 7, 5) => inv • 27. Perm 3 of line lengths in test 25 (7, 5, 12) => inv • 28. Perm 4 of line lengths in test 25 (7, 12, 5) => inv • 29. Perm 5 of line lengths in test 25 (5, 12, 7) => inv • 30. Perm 6 of line lengths in test 25 (5, 7, 12) => inv

  29. More test cases • 31. Three sides at max values (32767, 32767, 323767) => inv • 32. Two sides at max values (32767, 32767, 1) => inv • 33. One side at max values (32767, 1, 1) => inv

  30. Testing principles 1. Complete testing is not possible 2. Testing work is creative & difficult • need to understand the system • most systems are complex • need business knowledge, testing experience, creativity, insight and testing methodology

  31. Testing principles 4. Testing is risk based • safety-critical systems need high level • use risk as basis for allocating the test time available and selecting what to test 5. Testing must be planned • plan overall approach • what to test and when to stop • design tests • establish expected results for each selected test case

  32. Testing principles 6. Testing requires independence • unbiased measurement e.g. test team • goal is to measure software quality accurately • often conflict with the requirement to understand the system being tested (principle 2)

  33. Black-box methods • equivalence partitioning • boundary-value analysis • error guessing • cause-effect graphing

  34. Equivalence partitioning • based on the specification; no need to see the code • divide up the input domain into equivalence partitions or classes of data • each class is treated identically • any datum chosen from a class is as valid as any other • advantage: reduces the input domain to a manageable size

  35. Equivalence partitioning (cont) • to assist in identifying partitions, look in specs for terms such as “range”, “set” and other similar words • equivalence classes should not overlap • in addition to choosing one datum from each class, invalid data may also be chosen

  36. Equivalence partitioning (cont)example #1 • consider the exam processing program where we categorise the grade as A, B, C, D, F • assume A>=90, B>=80, C>=70, D>=60 • we can partition the grades, g, into the following partitions: 0<=g<60, 60<=g<70, 70<=g<80, 80<=g<90, g>=90 and g>100, g<0

  37. Equivalence partitioning (cont)example #1 exam processing program

  38. Equivalence partitioning (cont)example #2 • string searching program: the program prompts the user for a positive integer in the range 1 to 20 and then for a string of characters of that length. The program then prompts for a character and returns the position in the string at which the character was first found or a message indicating that the character was not present in the string. The user has the option to search for more characters.

  39. Equivalence partitioning (cont)example #2 • There are 3 equivalence classes to consider • one class of integers in the stated range • two classes of integers above and below the range • output domain consists of two classes • the position at which the character is found in the string • a message stating that it was not found

  40. Equivalence partitioning (cont)example #2 string processing program

  41. strengths and weakness of equivalence partitioning • strength: it does reduce size of input domain • well suited to data processing applications where input variables may be easily identified and take on distinct values • not easily applied to applications where input domain is simple yet the processing is complex

  42. strengths and weakness of equivalence partitioning • problem: although the specification may suggest that a class of data is processed identically, this may not be the case • example: y2k problem • also, the technique does not provide an algorithm for finding the partitions

  43. Boundary value analysis • used in conjunction with equivalence partitioning • this technique focuses on likely sources of faults: boundaries of equivalence classes • the technique relies on having created the equivalence classes equivalence partition boundaries

  44. Boundary value analysis (cont) exam processing program

  45. Boundary value analysis (cont)string processing program • integer values of 0, 1, 20 and 21 are obvious choices, • as well as finding the character in the first and last position

  46. Boundary value analysis (cont) string processing program

  47. Error guessing • an ad hoc approach, based on intuition and experience • identify tests that are likely to expose errors • make a list of possible errors or error prone situations and then develop tests based on the list

  48. Error guessing (cont)some items to try: • empty or null lists/strings • zero instances/occurrences • blanks or null characters in strings • negative numbers

  49. Error guessing (cont)strengths/weaknesses • intuition frequently accurate • the technique is efficient • technique relies on experience; not always available • the ad hoc nature leaves doubt about quality of the test: “did I forget any typical error situations?”

  50. Cause-effect graphing • functional or spec-based technique • systematic approach to selecting a set of high-yield test cases that explore combinations of input conditions • rigorous method for transforming a natural-language spec into a formal-language spec • exposes incompleteness and ambiguities in the spec

More Related