"Test Design Techniques"

hys_enterprise 882 views 63 slides Feb 17, 2020
Slide 1
Slide 1 of 63
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63

About This Presentation

Vladimir Arutin (QA Meetup)
Powered by HYS Enterprise


Slide Content

Test Design
Techniques
by Vladimir Arutin

VLADIMIR ARUTIN
QA ENGINEER
ISTQB® Certified Test Manager
ISTQB and QA Manual
Training Instructor
Certified Coach, Public Speaker
ABOUT MYSELF

WHY DO WE NEED TEST
TECHNIQUES?

COMMON TEST TECHNIQUES
STATIC DYNAMIC
•STRUCTURE-BASED
•SPECIFICATION-BASED
•EXPERIENCE-BASED
•STATIC ANALYSIS
•REVIEWS

DYNAMIC
TESTING

SPECIFICATION-BASED
TECHNIQUES

Equivalence Portioning
EQUIVALENCE
PORTIONING
1. Positive tests (clean tests):
–tests based on defined requirements
–tests based on common circumstances
2. Negative tests (dirty tests):
–tests based on errors/defects
–test based on special circumstances

Equivalence Portioning
EXAMPLE
A fitness tracker ‘Happy Tester’ measures the number of steps that are walked
each day and provides feedback to encourage the user:
Up to 1000-Couch Potato!
Above 1000, up to 2000-Lazy Bones!
Above 2000, up to 4000-Getting There!
Above 4000, up to 6000-Not Bad!
Above 6000-Way to Go!
1000 2000 4000 6000
1001
2001 4001 6001
1.0-1000
2.1001-2000
3.2001-4000
4.4001-6000
5.6001-+∞

Equivalence Portioning
BOUNDARY VALUES
Step 1:Identify equivalence classes
Step 2:Identify the boundary corresponding to each equivalent class
Step 3:Create test cases for each boundary value by selecting a
point on the boundary.
A B C
I II III IV
TWO-POINT BVA
B-1B+1

Equivalence Portioning
EXAMPLE
50
A speed control and reporting system has the following characteristics:
If you drive 50km/h or less, nothing will happen.
If you drive faster than 50km/h, but 55km/h or less, you will be warned.
If you drive faster than 55km/h but not more than 60km/h, you will be fined.
If you drive faster than 60km/h, your driving license will be suspended.
The speed in km/h is available to the system as an integer value.
Which would be the most likely set of values (km/h) identified by applying the boundary value
analysis, where only the boundary values on the boundaries of the equivalence classes are
relevant?
a)0, 49, 50, 54, 59, 60.
b)50, 55, 60.
c)49, 50, 54, 55, 60, 62.
d)50, 51, 55, 56, 60, 61.
6055
51 56 61

Equivalence Portioning
PAIRWISE TESTING
Divide et impera
REQUIREMENTS
COMPANY: Microsoft, Apple, Samsung, BlackBerry, Xiaomi, Sony
SCREEN:4.5', 5', 5.2', 5.5', 6', 6.9‘
RESOLUTION: HD, FullHD, 4K
RAM: 2Gb, 3Gb, 4Gb, 6Gb, 8Gb
PROCESSOR MAKE: QS650, MSM8230, QS820, A10, A11
OS:Android, BlackBerry OS, iOS, Windows Phone
NET STANDART: CDMA, GSM, LTE, 3G
STORAGE: 16Gb, 32Gb, 64Gb, 128Gb, 512Gb

Equivalence Portioning
PAIRWISE TESTING
REQUIREMENTS
COMPANY: Microsoft, Apple, Samsung, BlackBerry, Xiaomi, Sony
SCREEN:4.5', 5', 5.2', 5.5', 6', 6.9‘
RESOLUTION: HD, FullHD, 4K
RAM: 2Gb, 3Gb, 4Gb, 6Gb, 8Gb
PROCESSOR MAKE: QS650, MSM8230, QS820, A10, A11
OS:Android, BlackBerry OS, iOS, Windows Phone
NET STANDART: CDMA, GSM, LTE, 3G
STORAGE: 16Gb, 32Gb, 64Gb, 128Gb, 512Gb
MINIMUM TEST AMOUNT
6x 6x 3 x 5x 5 x 4 x 4 x 5=216000

Equivalence Portioning
PAIRWISE TESTING
COMPANY
SCREEN
RESOLUTION
RAMPROCESSOR
MAKE
OSNET
STANDART
STORAGE
BlackBerry4.5'HD 8GbQS650 BlackBerry
OS
LTE32Gb
Xiaomi 6.9'4K 2GbQS650 AndroidCDMA512Gb
Sony 5' 4K 3GbQS820 AndroidCDMA128Gb
Microsoft5.2'FullHD8GbMSM8230Windows
Phone
GSM128Gb
Samsung 6' 4K 6GbMSM8230Android3G 16Gb
Apple 5.5'4K 2GbA11 iOSCDMA64Gb

Equivalence Portioning
PICT

Equivalence Portioning
MORE TOOLS

Equivalence Portioning
DECISION TABLE
CONDITIONS
RULE 1RULE 2RULE 3RULE4
EMAIL
ADDRESS(T/F)
FTTF
PASSWORD
(T/F)
FFTT
OUTPUT(E/M)EEME
M -Main Page, E -Error

Equivalence Portioning
DECISION TABLE
R1R2R3R4R5
CONDITIONS
UserInserts Valid Card FTTTT
User Enters Valid PIN -FTNT
3Invalid PINs attempted -F-T-
Sufficient balance for the request--F-T
ACTIONS
Reject Card YNNNN
Prompt to Reenter PIN NYNNN
Eat the Card NNNYN
Dispense Requested CashNNNNY

STATE TRANSITION

Equivalence Portioning
Type of
coffee
Check
selected
coffee
Start
Money
back
Give
coffee
Wait for
enough
money
STATE TRANSITION
Validation
sum
Select type of
coffee
Enter money
Enough money, with or
w/o change
Enter
money
Not enough
money
Coffee exists
Coffee doesn’t exist

Equivalence Portioning
STATE TRANSITION
What is the minimum number of cases we should make for sum validation?
▪Determineallstates.
▪Considerandprioritizeaccordingtorequirementsall
wayswhichcoverwholefunctionality.
▪Identifyalltransitions.
▪Createatestcaseforeachway,thatcoversmain
functionality.
▪Createadditionaltestcasesthatcoverremaining
functionality(ifitisneeded).
How much times user has to enter money to get enough pay?
FIRST

Equivalence Portioning
EACH CHOICE
TESTING
Param1Param2Param3
A1X
B2Y
C3
4
5
Test
Case
Param1Param2Param3
1 A 1X
2 B 2Y
3 C 3X
4 A 4Y
5 B 5X

Equivalence Portioning
BASE CHOICE TESTING
Param1Param2Param3
A1X
B2Y
C3Z
Test CaseParam1Param2Param3
1
A2Y
2 B 2 Y
3 C 2 Y
4 A 1 Y
5 A 3 Y
6 A 2 X
7 A 2 Z

Equivalence Portioning
CLASSIFICATION TREE
METHOD
ACCESSING RESOURCES
Platform Agent Protocol
Role Browser
Windows
Mac OS
Unix
User Bot HTTP FTP
AdminInspectorOwnerChrome SafariFireFox
TC1
TC2
TC3
TC4
TC5

Equivalence Portioning
SYNTAX TESTING
Backus–NaurformorBackus normal form(BNF) is anotation technique
for context grammar for programming languages, document formats and
communication protocols.

Equivalence Portioning
SYNTAX TESTING
After BNF is approved, it is time to generate positive and negative cases:
Positive cases: find possible variants of values allowed by the individual elements
of the BNF definition, and then design cases to simply cover these variants.
Negative cases: define and apply possible mutations (e.g.: missing element,
unwanted extra element, invalid value for an element, and so on) to the
individual elements of the BNF definition.

Equivalence Portioning
SCENARIO TESTING
(USE CASE)

Equivalence Portioning
SCENARIO TESTING
(USE CASE)
12
Ways to Create Good Scenarios (by CemKaner):
1. Write life histories for objects in the system.
2. List possible users, analyze their interests and objectives.
3. Consider disfavored users: how do they want to abuse your system?
4. List “system events.” How does the system handle them?
5. List “special events.” What accommodations does the system make for these?
6. List benefits and create end-to-end tasks to check them.
7. Interview users about famous challenges and failures of the old system.
8. Work alongside users to see how they work and what they do.
9. Read about what systems like this are supposed to do.
10. Study complaints about the predecessor to this system or its competitors.
11. Create a mock business. Treat it as real and process its data.
12. Try converting real-life data from a competing or predecessor application.

Equivalence Portioning
SCENARIO TESTING
(USE CASE)
ROLES

Equivalence Portioning
RANDOM TESTING
You’ll say it’s useless ‘monkey’ testing and I’ll say
-automate it.
•Random Users (objects)
•Testing validationwith random data
•Randomized Behavior
•Fake the database
01. emailTextBx.click();
02. Random randomGenerator= newRandom();
03. intrandomInt= randomGenerator.nextInt(1000);
04. emailTextBx.sendKeys(“username” + randomInt+ “@gmail.com”);

Equivalence Portioning
RANDOM TESTING
Sample Program Using
Random Class in Java01. importjava.util.Random;
02. public class RandomTestDataGenerator{
03. public static voidmain(String[ ] args) {
04. Random r = new Random ();
05. String fullName= “fullName” + r.nextInt();
06. String firstName= “firstName” + r.nextInt();
07. String lastName= “lastName” + r.nextInt();
08. String streetAddress= “address” + r.nextInt();
09. long phoneNumber= (long) (Math.random() * 100000+ 3333000000L);
10. String email = “email” + r.nextInt() + “@gmail.com”;
11. System.out.println(“The Full Name is : “ + fullName);
12. System.out.println(“The First Name is : “+ firstName);
13. System.out.println(“The Last Name is : “ + lastName);
14. System.out.println(“The Address is : “ + streetAddress);
15. System.out.println(“The Phone Number is : “+ phoneNumber);
16. System.out.println(“The Email is : “+ email);
17. }
18. }

Equivalence Portioning
RANDOM TESTING
Sample Program using
Faker API in Java
01. java.until.Locale;
02. importcom.github.javafaker.Faker;
03. public classFakertestDataGenerator{
04. public static void main(String [ ] args) {
05. Locale locale= newLocale (“en-UKR”);
06. Faker faker= new Faker (locale);
07. String fullName= faker.name().fullName();
08. String firstName= faker.name().firstName();
09. String lastName= faker.name().lastName();
10. String phoneNumber= faker.phoneNumber().phoneNumber();
11. String address = faker.name().streetAddress();
12. String email = faker.internet().emailAddress();
13. System.out.println(“The Full Name is : “ + fullName);
14. System.out.println(“The First Name is : “+ firstName);
15. System.out.println(“The Last Name is : “ + lastName);
16. System.out.println(“The Address is : “ + streetAddress);
17. System.out.println(“The Phone Number is : “+ phoneNumber);
18. System.out.println(“The Email is : “+ email);
19. }
20. }

STRUCTURE-BASED
TECHNIQUES

Equivalence Portioning
LCSAJ TESTING
(Linear Code Sequence and Jump)
Characteristics of LCSAJ:
o100% LCSAJ means 100% Statement Coverage
o100% LCSAJ means 100% Branch Coverage
oLCSAJ is 100% procedure or Function call Coverage
o100% Multiple condition Coverage

Equivalence Portioning
STATEMENT TESTING
01. if (p = q) {
02. r = r + 1;
03. if (r < 5) {
04. s = 10;
05. }
06. } else if (p > q) {
07. s = 5;
08. }
How many test cases are needed to get
100% statement coverage?
Whichcombinationof p, q and r
valueswillensure100 %
statementcoverage?

Equivalence Portioning
STATEMENT TESTING
01. if (p = q) {
02. r = r + 1;
03. if (r < 5) {
04. s = 10;
05. }
06. } else if (p > q) {
07. s = 5;
08. }
if
r = r + 1
r < 5
p=q
p>q
s= 10 s = 5
ifif
statement
statement statement
Y
Y Y
N
NN

Equivalence Portioning
STATEMENT TESTING
The Matrix has you…
Follow the white rabbit…
Knock knock, Neo.

Equivalence Portioning
STATEMENT TESTING
01. if (p = q) {
02. r = r + 1;
03. if (r < 5) {
04. s = 10;
05. }
06. } else if (p > q) {
07. s = 5;
08. }
if
r = r + 1
r < 5
p=q
p>q
s= 10 s = 5
ifif
statement
statement statement
Y
Y Y
N
NN
1 2
2 TEST CASES FOR
STATEMENT COVERAGE
ARE REQUIRED

Equivalence Portioning
STATEMENT TESTING
if
“Enough, thanks”
b<35
a+b>40
if
Y N
if a+b> 40 THEN
Print “Enough, thanks”
ENDIF
If b < 35 THEN
Print “Please, add more”
ENDIF
“Please, add more”
Y N
ONLY 1TEST CASE FOR
STATEMENT COVERAGE
IS REQUIRED

Equivalence Portioning
if
“Enough, thanks”
b<35
a+b>40
if
Y N
if a+b> 40 THEN
Print “Enough, thanks”
ENDIF
If b < 35 THEN
Print “Please, add more”
ENDIF
“Please, add more”
Y N
1
BRANCH TESTING
2
2 TEST CASES FOR
BRANCH COVERAGE
ARE REQUIRED

Equivalence Portioning
Y N
if a+b> 40 THEN
Print “Enough, thanks”
ENDIF
If b < 35 THEN
Print “Please, add more”
ENDIF
“Please, add more”
1 2
PATH COVERAGE
3
4
a+b>40“Enough, thanks”
b<35
NY
4TEST CASES FOR
PATH COVERAGE
ARE REQUIRED

Equivalence Portioning
01. if ((p == 0)II(q>0)) {
02. r = r + 1;
03. if (r < 5) {
04. s = 10;
05. }
06. } else if (p > q) {
07. s = 5;
08. }
if
r = r + 1
r < 5 p>q
s= 10 s = 5
ifif
Y
Y Y
N
NN
CONDITION COVERAGE
(p == 0)II(q>0)

Equivalence Portioning
LOOP COVERAGE
1.main()
2.{
3.inti, n, f;
4.printf(“n = “);
5.scanf(“%d’, &n);
6.if (n <0) {
7.printf(“Invalid: %d\n”, n);
8.n = -1;
9.} else {
10.f =1;
11.for (i=1; i<=n; i++) {
12.f*= 1;
13.}
14.printf(“%d! =%d\n”, n, f);
15.}
16.return n;
17.}
if
for
TC1 n=0
TC2 n=1
TC3 n=15

Equivalence Portioning
CYCLOMATIC COMPLEXITY
Cyclomatic complexityis asoftware metricused to indicate the
complexity of a program and is a metric for software quality.
M=E−N+2P,
where
E=the number of edges of the graph.
N=the number of nodes of the graph.
P=the number ofconnected components.

Equivalence Portioning
CYCLOMATIC
COMPLEXITY
EXAMPLE:
M=E−N+2P
X=14
Y>Z
X=Y X =Z
Print
X, Y, Z
M=5−5+2*1
M= 2
life hack
M= If+1

EXPERIENCE-BASED
TECHNIQUES

Equivalence Portioning
ERRORS GUESSING
•Lessons gained from past releases
•Historical learning
•Past defects
•Production tickets
•Review Checklist
•Application UI
•Past test outcomes
•Risk reports of the application
•An assortment of information utilized for testing.
FAULT ATTACK

Equivalence Portioning
ERRORS GUESSING
WHERE ARE
THE ERRORS
HIDING?

Equivalence Portioning
EXPLORATORY
TESTING
5 Main Activities:
•Identify the purpose of the product
•Identify functions
•Identify areas of potential instability
•Test each function and record problems
•Design and record a consistency verification test

Equivalence Portioning
CHECKLIST-BASED
TESTING

STATIC
TESTING

Equivalence Portioning
DATA FLOW TESTING
Data Flow testing helps to find:
•A variable that is declared but never used within the program.
•A variable that is used but never declared.
•A variable that is defined multiple times before it is used.
•Deallocating a variable before it is used.

Equivalence Portioning
CONTROL FLOW
TESTING
define x
use y
kill z
define x
use x
use z
kill z
use x
define z
define y
use z
use y
use z
kill y
define z
Control Flow -the sequence in which
operations are performed during the
execution of a test item.
Example:
~define correct, the normal case
define-usecorrect, the normal case
use-killacceptable
use-defineacceptable
~use major blunder
define-killprobable programming error
define-definesuspicious, perhaps a programming error

Equivalence Portioning
REVIEWS
Planning
Define entry/exit criteria
Kick-off
Check entry criteria
Individual preparation
Noting incidents
Review meeting
Examine
Rework
Fixing defects
Follow-up
Check exit criteria

Equivalence Portioning
REVIEWS
InformalWalkthroughTechnical reviewInspection
Documented no yes yes yes
Led by author yes yes no no
Use checklists no optional optional yes
Moderator
(facilitator)
no yes ideally trained trained
Scribe no mandatory mandatory mandatory
Individual
preparation
no optional mandatory mandatory
Reviewerscolleague, buddydifferent peopletechnical expertsdifferent experts
Potential defects
logs
may be may be mandatory mandatory

Equivalence Portioning
REVIEWS
Advantages:
•Pick things which really count
•Clearly plan and track activities
•Provide training to participants
•Continuously improve the process and tools
•Report results
•Each review has clear objective
•Right people involved
•Atmosphere of trust
•Defects found welcomed and expressed objectively
•Checklists/roles used
•Management support
•Testers welcome as reviewers
•Emphasis on learning and process improvement

Equivalence Portioning
DOMAIN TESTING
EQUIVALENCE PORTIONING
BOUNDARY VALUES
PAIRWISE
DECISION TABLES
PATH TESTING
EXPIRIENCE-BASED TESTING
RISK-BASED TESING

TESTING THROUGHT OVER
TESTING IN THE END

PREVENTING BUGS OVER
FINDING BUGS

TESTING UNDERSTANDING OVER
CHECKING FUNCTIONALITY

BUILDING THE BEST SYSTEM OVER
BREAKING THE SYSTEM

TEAM RESPONSIBILITY FOR QUALITY
OVER TESTER RESPONSIBILITY

THE END

Test Design
Techniques
by Vladimir Arutin