w 5 Black Box Testing
-
Upload
juan-alexis-moreno-galleguillos -
Category
Documents
-
view
218 -
download
0
Transcript of w 5 Black Box Testing
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 1/59
28-04-2012
ICI500
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 2/59
Equivalence Partitioning Boundary Value Analysis
Use Case Testing
Decision Table Testing State Transition Testing
Questios for the class
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 3/59
Unfeasible exhaustive testing means we needa limited subset of all possible inputs.
How to select the best subset? Why EP?
◦ The concept of defect clustering Test case design by EP has three :
1. Identify the equivalence classes (EC)2. Define the test cases
3. Define expected output Coverage
◦ Number of tested EC/total number of EC
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 4/59
Employee receive a Christmas bonus equal to50% of their monthly income if they havebeen working for the company for more thanthree years, employees who have been
employed for more than five years receive a75% bones, and those with more than eightyears of employment are awarded a 100%bonus.
How many equivalence classes you see?
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 5/59
Employment in Years vEc1: 0 <= x <= 3vEc2: 3 < x <= 5vEc3: 5 < x <= 8vEc4: x > 8
iEc1: x < 0iEc2: x > 70
24712
-380
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 6/59
1. Identify the equivalence classes (EC)1. (*)Identify the domain for each input parameter
2. (*)Subdivide until no more partitions can be made
2. Define the test cases
1. Select representatives (one per each class)2. Create the test cases
1. (**)Multiply the Number of valid EC per parameter
2. (**)Sum the Number of invalid EC per parameter
3. Define the expected outcomes for each Test Case
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 7/59
The specification for calculating the price is thefollowing:◦ The starting point is minus , where
is the basic price of the product and is the reduced amount done by salesman
◦ A for a special type of product and the pricefor extra sub-products ( ) shall be added
◦ If 3 or more sub-products are chosen there is adiscount of 10% on these sub-products only. If 5 ormore are chosen then a 15% is applied
◦
The granted by the salesman is applied to theonly, but the discount on extras is applied toonly
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 8/59
Identify the domain for each input parameter
Baseprice vEc11: [MIN_DOUBLE, … , MAX_DOUBLE]
iEc11: NaNspecialprice vEc21: [MIN_DOUBLE, … , MAX_DOUBLE]
iEc21: NaN
extraprice vEc31: [MIN_DOUBLE, … , MAX_DOUBLE]iEc31: NaN
extras vEc41: [MIN_INT, … , MAX_INT]iEc41: NaN
discount vEc51: [MIN_DOUBLE, … , MAX_DOUBLE]iEc51: NaN
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 9/59
Subdivide until no more partitions can bemade◦ Parameter 1 to 3 are prices. Prices are always
positive. However, there is no limit on this.
◦ The value controls the discount of extrapricewhere 10% if extras>=3 and 15% if extras>=5.
must be positive, because you can’t buynegative items.
◦
The shall be a percentage. Therefore avalue between 0-100 must be defined. Consultationwith the client should be done
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 10/59
Baseprice vEc11: [0, … , MAX_DOUBLE]iEc11: [MIN_DOUBLE, … , 0[iEc12: NaN
specialprice vEc21: [0, … , MAX_DOUBLE]iEc21: [MIN_DOUBLE, … , 0[iEc22: NaN
extraprice vEc31: [0 … , MAX_DOUBLE]
iEc31: [MIN_DOUBLE, … , 0[ iEc32: NaN
extras vEc41: [0, 1 , 2]vEc42: [3, 4]vEc43: [5, … , MAX_INT]
iEc41: [MIN_INT, … , 0[ iEc42: NaN
discount vEc51: [0, … , 100]iEc51: [MIN_DOUBLE, … , 0[ iEc52: ]100, … , MAX_DOUBLE] iEc53: NaN
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 11/59
Baseprice vEc11: [0, … , MAX_DOUBLE]iEc11: [MIN_DOUBLE, … , 0[iEc12: NaN
20000.00-1.00“abc”
specialprice
vEc21: [0, … , MAX_DOUBLE]iEc21: [MIN_DOUBLE, … , 0[iEc22: NaN
3450.00-1.00“abc”
extraprice vEc31: [0 … , MAX_DOUBLE]
iEc31: [MIN_DOUBLE, … , 0[ iEc32: NaN
6000.00
-1.00“abc”
extras vEc41: [0, 1 , 2]vEc42: [3, 4]vEc43: [5, … , MAX_INT]
iEc41: [MIN_INT, … , 0[ iEc42: NaN
1320
-1“abc”
discount vEc51: [0, … , 100]iEc51: [MIN_DOUBLE, … , 0[ iEc52: ]100, … , MAX_DOUBLE]
iEc53: NaN
10.00-1.00101.00
“abc”
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 12/59
1 20000.00 3450.00 6000.00 1 10.00
2 20000.00 3450.00 6000.00 3 10.00
3 20000.00 3450.00 6000.00 20 10.00
4 -1.00 3450.00 6000.00 1 10.00
5 “abc” 3450.00 6000.00 1 10.00
6 20000.00 -1.00 6000.00 1 10.00
7 20000.00 “abc” 6000.00 1 10.00
8 20000.00 3450.00 -1.00 1 10.00
9 20000.00 3450.00 “abc” 1 10.00
10 20000.00 3450.00 6000.00 -1 10.00
11 20000.00 3450.00 6000.00 “abc” 10.00
12 20000.00 3450.00 6000.00 1 -1.00
13 20000.00 3450.00 6000.00 1 101.00
14 20000.00 3450.00 6000.00 1 “abc”
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 13/59
1 20000.00 3450.00 6000.00 1 10.00 27450.00
2 20000.00 3450.00 6000.00 3 10.00 26850.00
3 20000.00 3450.00 6000.00 20 10.00 26550.004 -1.00 3450.00 6000.00 1 10.00 NOT_VALID
5 “abc” 3450.00 6000.00 1 10.00 NOT_VALID
6 20000.00 -1.00 6000.00 1 10.00 NOT_VALID
7 20000.00 “abc” 6000.00 1 10.00 NOT_VALID
8 20000.00 3450.00 -1.00 1 10.00 NOT_VALID
9 20000.00 3450.00 “abc” 1 10.00 NOT_VALID
10 20000.00 3450.00 6000.00 -1 10.00 NOT_VALID11 20000.00 3450.00 6000.00 “abc” 10.00 NOT_VALID
12 20000.00 3450.00 6000.00 1 -1.00 NOT_VALID
13 20000.00 3450.00 6000.00 1 101.00 NOT_VALID
14 20000.00 3450.00 6000.00 1 “abc” NOT_VALID
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 14/59
What level of equivalence class coverage didwe achieved?
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 15/59
A compiler for subset of the DIMENSIONstatement of the FORTRAN language
General rules◦ DIMENSION statements can span over multiple lines
◦ Items in italics indicate variables
◦ Brackets indicate optional items
◦ Ellipsis indicates succession
◦ Form of the dimension statement is:
DIMENSION ad [,ad ]…
◦ ad is an array descriptor of the form
n(d[,d]…)
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 16/59
n = symbolic name of the array d = dimension declarator
n can be 1-6 letter or digits, the first charmust be a letter
d is defined as follows:◦ [lb:]ub
◦ lb and ub are the lower and upper bounds
◦
Must be in the range -65534 to 65535◦ If lb not specified is 1
◦ ub >= lb
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 17/59
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 18/59
1. Identify restrictions and conditions2. For each restriction/condition create:
1. One valid and two invalid classes if the domain is: E.g. “the item count can be from 1 to 999”), identify one
valid equivalence class (1 < item count < 999) and two invalidequivalence classes (item count < 1 and item count > 999).
: E.g. “one through six owners can be listed for theautomobile”, identify one valid equivalence class and two invalidequivalence classes (no owners and more than six owners).
2. One valid class for each valid input and only one invalid if thedomain is:
: E.g. type of vehicle must be BUS, TRUCK,TAXICAB, PASSENGER, or MOTORCYCLE. Identify a valid equivalenceclass for each and one invalid equivalence class (“TRAILER”).
3. Only one valid and only one invalid class if the domain is:: E.g. first character of the identifier must be a
letter,” identify one valid equivalence class (it is a letter) and oneinvalid equivalence class (it is not a letter).
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 19/59
Differences with EP◦ Focus only in the boundaries
What it does?◦ Checks the “border” of the equivalence classes ◦ How many test cases for each boundary?
Why BVA? What is the disadvantage of this technique? Test case design by BVA has two :
1. Identify the boundary values (BVs)2. Define test cases
(Freely) combine valid boundary values in test cases Single test case for each invalid boundary value
Coverage◦ Number of tested BVs/ total number of BVs
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 20/59
The customer has given the followingadditional information:◦ The base price is between 10,000 and 150,000
◦ The special price for the extra items is between 800
and 3,500◦ The maximum possible extras is 25
◦ The extra prices are between 50 and 750
◦ The maximum salesman discount is 25%
What are the valid BVs and invalid BVs?
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 21/59
Baseprice 10000.00, 10000.01, 149999.99, 150000.00
Specialprice 800.00, 800.01, 3499.99, 3500.00
Extraprice 50.00, 50.01, 18749.99, 18750.00
Extras 0, 1, 2, 3, 4, 5, 6, 24, 25Discount 0.00, 0.01, 24.99, 25.00
Baseprice 9999.99, 150000.01
Specialprice 799.99, 3500.01
Extraprice 49.99, 18750.01
Extras -1, 26
Discount -0.01, 25.01
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 22/59
What is the minimum set of test cases we canbuild to get 100% BVA coverage?
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 23/59
1 10,000.00 800.00 50.00 0 0.00 10,850
2 10,000.01 800.01 50.01 1 0.01 10,849.03
… … … … … … …
10 9,999.99 1000.00 700.00 2 10.00 NOT_VALID
11 150,000.01 1000.00 700.00 2 10.00 NOT_VALID
… … … … … … …
19 150,00.00 1000.00 700.00 2 25.01 NOT_VALID
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 24/59
MTEST is a program that grades multiple-choice examinations. Theinput is a data file named OCR, with multiple records that are. Per the file specification, the first record is a title used
as a title on each output report. The next set of records describes thecorrect answers on the exam. These records contain a
. In the first record of this set, the number of questions is listedin columns . Columns 10–59 contain the correctanswers for questions 1–50 (any character is valid as an answer).
Subsequent records contain,.
The third set of records describes the answers of each student; each of these records contains a . For each student, the firstrecord contains the student’s name or number in (anycharacters); columns
. If the test has more than 50 questions, subsequent records for the
student contain answers , in columns 10–59.The .
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 25/59
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 26/59
4 Output records1. A report, sorted by student identifier,
showing each student’s grade (percentageof answers correct) and rank.
2. A similar report, but sorted by grade.
3. A report indicating the mean, median, andstandard deviation of the grades.
4. A report, ordered by question number,showing the percentage of studentsanswering each question correctly.
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 27/59
Empty input file 999 question exam
0 Students
200 Students
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 28/59
1. Empty input file.2. Missing title record.3. 1-character title.4. 80-character title.5. 1-question exam.
6. 50-question exam.7. 51-question exam.8. 999-question exam.9. 0-question exam.10. Number-of-questions field has nonnumeric value.11. 0-correct-answer.12. Too many correct-answer records.13. Too few correct-answer records.
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 29/59
14. 0 students.15. 1 student.
16. 200 students.
17. 201 students.
18.
A student has one answer record, but there are twocorrect- answer records.
19. The above student is the first student in the file.
20. The above student is the last student in the file.
21. A student has two answer records, but there is just
one correct-answer record.22. The above student is the first student in the file.
23. The above student is the last student in the file.
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 30/59
0 Students 1 Student
200 Students
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 31/59
24. All students receive the same grade.25. All students receive a different grade.26. Some (not all) students receive the same grade.
Why?27. A student receives a grade of null28. A student receives a grade of 1029. A student has the lowest possible identifier.
Why?30. A student has the highest possible identifier.
31. The number of students is such that the reportis just large enough to fit on one page. Why?32. The number of students is such that all
students but one fit on one page.
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 32/59
33. The standard deviation is at its maximum
All the other are already contained in Test Case24
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 33/59
34. All students answer question 1 correctly.35. All students answer question 1 incorrectly.36. All students answer the last question
correctly.
37. All students answer the last questionincorrectly.
38. The number of questions is such that thereport is just large enough to fit on one
page.39. The number of questions is such that all
questions but one fit on one page.
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 34/59
BVA works for INPUTS and OUTPUTS◦ E.g. An information-retrieval system displays the
most relevant paragraphs based on an inputrequest, but paragraphs
◦
Write test cases such that the program displays, and write a test
case that might cause the program to.
Remember valid BVs can be freelycombined. However, invalid ones can’t
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 35/59
Tests can be derived from use cases Use cases might be described at an abstract level
or at the system level Each use case has: preconditions, post-
conditions, mainstream scenario and alternative
scenarios Useful for
◦ designing acceptance tests with customer/userparticipation
◦ system testing. Why?◦
uncover integration defects. Why? Coverage
◦ At least one test case per use case
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 36/59
GetMoney
PINQuery
Eat CardCondition:{3rd wrong PIN input}
Client
PaymentUnit
Bank
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 37/59
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 38/59
One weakness of boundary-value analysisand equivalence partitioning is that they donot explore combinations of inputcircumstances
Decision tables are a good way to capturesystem requirements that contain logicalconditions
Coverage is to have
in the table Strength is that it exercises conditions that
will not be covered otherwise
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 39/59
If Student A and Student B are friends and if Student (A) don’t go to lectures, then Student(B) will need to take additional notes
If Student A and Student B are friends and if
Student (B) don’ go to lectures, then Student(A) will need to take additional notes
If neither Student (A) nor Student (B) go tolectures and is the final session, then both
will fail the final exam If both Students go to lectures and is the final
session, then both will pass the exam
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 40/59
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 41/59
Conditions R 1 R 2 R 3 R 4 R 5 R 6 R 7 R 8 R 9 R 10 R 11 R 12 R 13 R 14 R 15 R 16
A goes T T T T T T T T F F F F F F F F
B goes T T T T F F F F T T T T F F F F
A and B are friends T T F F T T F F T T F F T T F F
Is Final Session T F T F T F T F T F T F T F T F
Actions
A takes additional notes F F F F F T F F F F F F F F F F
B takes additional notes F F F F T F F F T T F F F F F F
Both pass the exam T F T F F F F F F F F F F F F F
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 42/59
A system may exhibit a different responsedepending on current conditions or
A state table shows the relationship between thestates and inputs, and can highlight possibletransitions that are valid
Test cases can be designed to cover:◦ a common sequence of states◦ every state◦
every transition◦ specific sequence of transitions
◦ invalid transitions
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 43/59
State: Is a in which a system isfor one or more . States
“remember” inputs the system has received inthe past and define how the system should
respond to subsequent events when theyoccur.
Transition: Represents a from onestate to another caused by an event
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 44/59
Event: within/outside the systemthat the system to .Events can be independent or causally related
Action: initiated because of a state
change. Actions betweenstates
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 45/59
Represent a Reservation process by using aState Transition diagram
Entry point will be a
Exit point will be a
Start by and
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 46/59
Source: Copeland 2004
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 47/59
Using the above diagram, can you build astate transition table? Use the followingtemplate:
null giveInfo startPayTimer Made
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 48/59
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 49/59
Source: Copeland 2004
Why are STT useful?
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 50/59
1. Create test cases that atleast once
2. Create test cases that atleast once
3. Create test cases that (becareful with the )
4. Create test cases that
at least once5. Create from the state
transition table
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 51/59
Visit States Trigger Events
Source: Copeland 2004
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 52/59
Execute all paths
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 53/59
Exercise transitions
Source: Copeland 2004
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 54/59
Invalid transitions using the table (see above)
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 55/59
Which of the followingstatements about thegiven state table is TRUE?◦ a)
◦ b)
◦ c)
◦ d)
Source: ISTQB 2011
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 56/59
Which of thefollowingstatements areTRUE?◦ A. The test case
table exercisesthe shortestnumber of
transitions.◦ B. The test case
gives only thevalid statetransitions.
◦ C. The test casegives only theinvalid statetransitions.
◦ D. The test caseexercises thelongest numberof transitions.
Source: ISTQB 2011
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 57/59
An employee’s bonus is to be calculated. Itcannot become negative, but it can be calculatedto zero. The bonus is based on the duration of the employment. An employee can be employed
for less than or equal to 2 years, more than 2years but less than 5 years, 5 to 10 years, orlonger than 10 years. Depending on this periodof employment, an employee will get either nobonus or a bonus of 10%, 25% or 35%.
How many equivalence partitions are needed totest the calculation of the bonus?
Source: ISTQB 2011
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 58/59
Which of the following statements about the benefits of derivingtest cases from use cases are most likely to be true?A. Deriving test cases from use cases is helpful for system andacceptance testing.B. Deriving test cases from use cases is helpful only for automatedtesting.
C. Deriving test cases from use cases is helpful for componenttesting.D. Deriving test cases from use cases is helpful for testing the
interactionbetween different components of the system. a) A and D are true; B and C are false.
b) A is true; B, C and D are false. c) A and B are true; C and D are false. d) C is true; A, B and D are false.
Source: ISTQB 2011
7/31/2019 w 5 Black Box Testing
http://slidepdf.com/reader/full/w-5-black-box-testing 59/59