Software continues to revolutionize the world, impacting nearly every aspect of our work, family, and personal life. Artificial intelligence (AI) and machine learning (ML) are playing key roles in this revolution through improvements in search results, recommendations, forecasts, and other predictions. AI and ML technologies are being used in platforms for digital assistants, home entertainment, medical diagnosis, customer support, and autonomous vehicles. Testing practitioners are recognizing the potential for advances in AI and ML to be leveraged for automated testing—an area that still requires significant manual effort. Tariq King and Jason Arbon introduce you to the world of AI for software testing. Learn the fundamentals behind autonomous and intelligent agents, ML approaches including Bayesian networks, decision tree learning, neural networks, and reinforcement learning. Discover how to apply these techniques to common testing tasks such as identifying testable features, generating test flows, and detecting erroneous states.
2. 2
A Self-Testing Approach
for Autonomic Software
Tariq M. King
Major Advisor:
Dr. Peter J. Clarke
JASON ARBON
FOUNDER AND CEO
TARIQ KING
SR. DIRECTOR, QUALITY ENGINEERING
Joanne Tseng
Data Scientist
@test.ai
Gregg Tabot
Machine Learning Engineer
@test.ai
Dionny Santiago
Principal Quality Architect
@ultimatesoftware
David Adamo Jr.
Quality Engineer
@ultimatesoftware
ARCHITECTS, ENGINEERS AND SCIENTISTS
THE REAL
4. 4
Artificial Intelligence for Software Testing (AIST)
is an emerging field aimed at the development
of AI systems to test software, methods to test
AI systems, and ultimately designing software
that is capable of self-testing and self-healing.
5. 5
AI TESTING TESTING AI
SELF-TESTING
TOOLS METHODS
DESIGNS
THIS TUTORIAL
On completion, participants will be able to:
o Explai nfu nda ment al ter ms and concep ts
used in the field of AI and ML.
o D escrib e vari ou s ML ap p roaches su ch as
D ecisi on Tree L earni ng, Rei nf orce ment
Learning, Neural and Bayesian networks.
o Discuss the AI-driven testing techniques
used in practice to validate mobile and
web applications.
o Identify tools and frameworks to aid
the development of AI-driven software
testing systems.
LEARNING OBJECTIVES
AI-DRIVEN TESTING
TOOLS
6. 6
OUTLINE
INTRODUCTION TO AI AND ML
o Autonomous and Intelligent Agents
o Machine Learning Approaches
o Classification: Training, Validation, Evaluation
AI-DRIVEN SOFTWARE TESTING
o Perceiving the Environment with Decision Trees
o Generating Inputs with Neural Nets and Reinforcement Learning
o Classifying Test Failures and Flakiness with Bayesian Nets
FUTURE TRENDS IN AI-DRIVEN TESTING
INTELLIGENCEINTELLIGENCEQuickness of understanding, high mental capacity, sound judgment and reason.
9. 9
artificial intelligence:
: a branch of computer science dealing with the
simulation of intelligent behavior in computers
: the capability of a machine to imitate intelligent
human behavior
1
2
10. 10
Perceive and act in its environment using sensors
and actuators, respectively.
Direct its activity toward goals and use knowledge
and learning in achieving those goals.
Analyze itself in terms of behavior, error, and success
and adapt online, possibly in real time.
Be organized with other agents, typically in a hierarchy
to tackle problems at different abstraction levels.
Typically referred to as bots or AI’s.
AN AUTONOMOUS ENTITY THAT CAN…
INTELLIGENT AGENT
11. 11
TYPES OF INTELLIGENT AGENTS
SIMPLE REFLEX AGENTS MODEL-BASED AGENTS GOAL-BASED AGENTS
UTILITY-BASED AGENTS LEARNING AGENTS
To acquire knowledge of, or skill in, by study, instruction or experience.
14. 14
If a program can improve how it performs a certain
task based on previous experience then you can
say the program has learnt.
If a program can improve how it performs a certain
task based on previous experience then you can
say the program has learnt.
If th ep erfo rm anc eP of a comp ut er p rog ram at
compl et ing a t ask T imp roves w ith exp erienc eE,
the program is said to learn from experience E.
16. 16
SUPERVISED
MACHINE LEARNING CATEGORIES
UNSUPERVISED REINFORCEMENT
Well-Labeled Data
Knowledge of Data/Outcome
Learning Based on Known Patterns
Unlabeled Data
No Knowledge of Data/Outcome
Discovering Unknown Patterns
Generating Data through Actions
Reward/Punish Based on Outcome
Learning By Trial-and-Error
MACHINE LEARNING CATEGORIES
Desired Output
{ 1,…, }
Desired Output
{ 1,…, }
Model
{ 1,…, }
Model
{ 1,…, }
World (or Data)World (or Data)
SUPERVISED
Model
{ 1,…, }
Model
{ 1,…, }
World (or Data)World (or Data)
UNSUPERVISED
Model OutputModel Output
Model
{ 1,…, }
Model
{ 1,…, }
World (or Data)World (or Data)
ReinforcementReinforcement
REINFORCEMENT
17. 17
MACHINE LEARNING CATEGORIES
SUPERVISED UNSUPERVISED
CLUSTERINGREGRESSIONCLASSIFICATION
BAYESIAN (BELIEF) NETWORKS
DECISION TREES
OUTLOOK
SUNNY OVERCAST RAIN
HUMIDITY WIND
HIGH NORMAL
YES
NO YES NOYES
NEURAL NETWORKS K-MEANS CLUSTERING
REINFORCEMENT LEARNING
MACHINE LEARNING APPROACHES
18. 18
GETTING STARTED WITH AI & ML
HALITE II: MAY THE BEST BOT WIN
https://halite.io
GETTING STARTED WITH AI & ML
HALITE II: MAY THE BEST BOT WIN
https://halite.io
Starter Bot 1: Simple Reflex Agent
19. 19
GETTING STARTED WITH AI & ML
HALITE II: MAY THE BEST BOT WIN
Starter Bot 2: Learning Agent
20. 20
Labeled
Data
Training Set
Testing Set
Features
Outlook Temp Humidity Windy Play Tennis
1 Rainy Hot High False No
2 Rainy Hot High True No
3 Overcast Hot High False Yes
4 Sunny Mild High False Yes
5 Sunny Cool Normal True Yes
6 Sunny Cool Normal True Yes
7 Overcast Cool Normal True Yes
8 Rainy Mild High False No
Class
9 Rainy Hot High False ?
10 Rainy Hot High True ?
11 Overcast Hot High False ?
12 Sunny Mild High False ?
CLASSIFICATION
SUPERVISED LEARNING: TRAINING AND VALIDATION
Data
Training Set
Testing Set
ML Algorithm
Model
Builds
+
+
-
+
-
+
+
+
-
+
-
+
Predictions
Predicted Class
Yes No
Actual
Class
Yes 4 1
No 0 10
Confusion Matrix
Evaluation
CLASSIFICATION
SUPERVISED LEARNING: TRAINING AND VALIDATION
21. 21
+
+
-
+
-
+
+
+
-
+
-
+
Predictions
Predicted Class
Yes No
Actual
Class
Yes 4 1
No 0 10
Confusion Matrix
Evaluation
Accuracy =
Number of Correct Predictions
Total Number of Predictions
= 14 ÷ 15 = ~93.3%
Error =
Number of Wrong Predictions
Total Number of Predictions
= 1 ÷ 15 = ~6.7%
CLASSIFICATION
PERFORMANCE MEASURES: ACCURACY AND ERROR
+
+
-
+
-
+
+
+
-
+
-
+
Predictions
Evaluation
CLASSIFICATION
PERFORMANCE MEASURES: PRECISION AND RECALL Predicted Class
Yes No
Actual
Class
Yes
No
Confusion Matrix
TRUE
POSITIVES
TRUE
NEGATIVES
FALSE
NEGATIVES
FALSE
POSITIVES
The confusion matrix produced by classifiers shows four entities:
o True Positives, False Positives, True Negatives, False Negatives
Precision =
Recall =
What percentage of positive
identifications were correct?
What percentage of actual
positives were identified?
22. 22
+
+
-
+
-
+
+
+
-
+
-
+
Predictions
Evaluation
CLASSIFICATION
PERFORMANCE MEASURES: PRECISION AND RECALL
Precision =
Recall =
Predicted Class
Yes No
Actual
Class
Yes
No
Confusion Matrix
TRUE
POSITIVES
TRUE
NEGATIVES
FALSE
NEGATIVES
FALSE
POSITIVES
The confusion matrix produced by classifiers shows four entities:
o True Positives, False Positives, True Negatives, False Negatives
True Positives
True Positives + False Positives
True Positives
True Positives + False Negatives
F1 Score =
Harmonic mean of precision and recall
which reaches its best at 1, worst at 0.
Evaluation
CLASSIFICATION
PERFORMANCE MEASURES: PRECISION AND RECALL
Precision =
Recall =
Confusion Matrix
TRUE
POSITIVES
TRUE
NEGATIVES
FALSE
NEGATIVES
FALSE
POSITIVES
The confusion matrix produced by classifiers shows four entities:
o True Positives, False Positives, True Negatives, False Negatives
True Positives
True Positives + False Positives
True Positives
True Positives + False Negatives
F1 Score =
Precision ∙ Recall
Precision + Recall
2 ∙
24. 24
OUTLINE
AI-DRIVEN SOFTWARE TESTING
o Perceiving the Environment with Decision Trees
o Generating Inputs with Neural Nets and Reinforcement Learning
o Classifying Test Failures and Flakiness with Bayesian Nets
TESTING BOTS
AI-DRIVEN TESTING FROM THE OUTSIDE-IN
25. 25
AI-DRIVEN TESTING IN PRACTICE
AI-DRIVEN TESTING IN PRACTICE
+
MACHINE LEARNING TEST DRIVERS CLOUD COMPUTING
+
Artificial Neural Networks
Decision Tree Learning
Reinforcement Learning
Bayesian Networks
Selenium, Sikuli, Robot
Appium, Calabash, Robotium
JUnit, Nunit, xUnit
Custom-Built
Test Execution
Environment Provisioning
Data Generation
Analysis/Reporting
26. 26
TEST BOT TRAINING
HOW BOTS LEARN TO PERCEIVE THE APPLICATION
html
head body
title pdiv
font-size: 16px
Hello Worldimg
font-size : 16px
font-weight: bold
Compute Render Trees
PERCEIVE
What can we interact with?
Train Image Recognition
LOGINLOGIN
WEB UI CLASSIFICATION
Suppose you wanted to use ML to identify various
elements of a user interface.
EXAMPLE: PERCEIVING WEB PAGES, CONTROLS, ERROR MESSAGES
27. 27
WEB UI CLASSIFICATION
MODEL TRAININGFEATURE ENGINEERINGDATA PREPARATION
Decision Trees
Random Forests
Determine attributes to modelGather and pre-process data
Web Page Labeling
Computed Render Trees
Is Text?
Distance from Nearest Input
Nearest Color
Value of Attribute For
Train the ML classifier
SUPERVISED LEARNING APPROACH
WEB UI CLASSIFICATION
PAGE LABELING IN PRACTICE
29. 29
DECISION TREES
A TREE-LIKE MODEL OF DECISIONS AND THEIR POSSIBLE OUTCOMES
Decision Node
Chance Node
Outcome Node
NOTATION
DECISION TREES
A TREE-LIKE MODEL OF DECISIONS AND THEIR POSSIBLE OUTCOMES
Go to
Work
Go
Fishing
75%
25%
64%
36%
Keep Job
Lose Job
Catch Fish
Fail to Catch Fish
30. 30
DECISION TREES
KEY ADVANTAGES
EASY
Simple to Understand
Minimal Data Preparation
Explainable Results
VALUABLE
Picking Best Option Quantitatively
Useful Without Hard Data
Handles Categorical/Numerical Data
EXTENSIBLE
Allows for New Scenarios
Models Problems with Multiple Outputs
Combines with Other Decision Tools
1
2 3
DECISION TREES: AI FOR TESTING
TRAINING ELEMENT CLASSIFIERS
31. 31
DECISION TREES
SAMPLE DECISION TREE FOR CLASSIFYING WEB ELEMENTS
Gini = 0.00
Samples = 7285
Value = [11534, 0]
Class = None
Is Text?
Gini = 0.01
Samples = 10943
Value = [17273, 86]
Class = None Gini = 0.00
Samples = 2332
Value = [3701, 0]
Class = None
Nearest Color <= 2.5?
Gini = 0.029
Samples = 3658
Value = [5739, 86]
Class = None
Input Distance <= 0.035
Gini = 0.07
Samples = 1326
Value = [2038, 86]
Class = None
Attr For <= 0.5
Gini = 0.499
Samples = 68
Value = [56, 61]
Class = LabelCandidate
Gini = 0.0
Samples = 191
Value = [328, 0]
Class = None
Nearest Color <= 1.5
Gini = 0.237
Samples = 259
Value = [384, 61]
Class = None
Font Weight <= 0.125
Gini = 0.086
Samples = 361
Value = [533, 25]
Class = None
Gini = 0.0
Samples = 706
Value = [1121, 0]
Class = None
Input Distance <= 0.191
Gini = 0.029
Samples = 1067
Value = [1654, 25]
Class = None
DECISION TREES
KEY DRAWBACKS
INSTABILITY
Small Changes in Data
Cause Great Change in Structure
No Efficient Way to Find Optimal
OVERFITTING
Tree Becomes Very Large
Model Too Specific to Training Set
Memorizing vs. Generalizing
LIMITED ACCURACY
Discretization of Continuous Attributes
Less Accurate for Regression
“Noisy” Data Causes Inaccuracies
33. 33
MODELING THE APPLICATION
+
PLAYING DOMINOES WITH GRAPH PIECES
GENERATING TEST ACTIONS
SELECTING A FINITE NUMBER OF USER INPUTS FROM AN INFINITELY LARGE DOMAIN
INPUT SPACE
EXPLOSION
150 actions per page
35 steps
150 =
35
paths10
78
PROBABILISTIC
MODELING
Some elements
and actions are
more interesting
than others.
~20%
~5%
# atoms in
the universe
34. 34
GENERATING TEST ACTIONS
HOW BOTS LEARN TO TAP, TYPE, AND SWIPE
PERCEIVE
What can we interact with?
ACT
ML determines action
LEARN
Feedback trains brain
UI Elements
Wrong
Rewrite
Correct
Reinforce
Artificial Neural Network
Input Hidden Output
REINFORCEMENT LEARNING
AGENTS LEARN OPTIMAL INTERACTIONS WITH DYNAMIC ENVIRONMENT BY TRIAL AND ERROR
In each experience, the agent takes an action a in state
s, receives a reward r, and moves to state s’.
35. 35
REINFORCEMENT LEARNING
In each experience, the agent takes an action a in state
s, receives a reward r, and moves to state s’.
ACTION REWARD TRANSITION NEXT ACTIONPUNISHOR
AGENTS LEARN OPTIMAL INTERACTIONS WITH DYNAMIC ENVIRONMENT BY TRIAL AND ERROR
REINFORCEMENT LEARNING
THREE PARTS OF A REINFORCEMENT LEARNING PROBLEM
ENVIRONMENT
At least partially observable
by means of sensors
REWARD FUNCTION
Maps state-action pairs
to reward value
Defines how to choose a
“good” action in each state
VALUE FUNCTION
36. 36
Q-LEARNING
TRACKING LONG-TERM REWARDS, NOT JUST IMMEDIATE ONES
OLD VALUE LEARNING
RATE
REWARD DISCOUNT
FACTOR ESTIMATE OF OPTIMAL
FUTURE REWARD
LEARNED VALUE
Maps an action in a particular state to
its expected long-term reward.
Q-LEARNING
EXAMPLE WALKTHROUGH
2
10
4
3
5
5
Select Choice: (2, 3)
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
37. 37
Q-LEARNING
EXAMPLE WALKTHROUGH
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
2, 3 ← 0.0 0.8 · max 3, 1 , 3, 42, 3 ← 0.0 0.8 · max 3, 1 , 3, 4
2, 3 ← 0.0 0.8 · max 0 , 0 02, 3 ← 0.0 0.8 · max 0 , 0 0
Q-LEARNING
EXAMPLE WALKTHROUGH
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
Select Choice: (3, 1)
38. 38
Q-LEARNING
EXAMPLE WALKTHROUGH
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
3, 1 ← 0.0 0.8 · max 1, 5 , 1, 33, 1 ← 0.0 0.8 · max 1, 5 , 1, 3
3, 1 ← 0.0 0.8 · max 0 , 0 03, 1 ← 0.0 0.8 · max 0 , 0 0
Q-LEARNING
EXAMPLE WALKTHROUGH
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
Select Choice: (1, 5)
39. 39
Q-LEARNING
EXAMPLE WALKTHROUGH
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
1, 5 ← 100 0.8 · max 5, 5 , 5, 11, 5 ← 100 0.8 · max 5, 5 , 5, 1
1, 5 ← 100 0.8 · max 0 , 0 1001, 5 ← 100 0.8 · max 0 , 0 100
100
100
Q-LEARNING
EXAMPLE WALKTHROUGH
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
Select Choice: (2, 3)
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 0
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
100
40. 40
Q-LEARNING
EXAMPLE WALKTHROUGH
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
2, 3 ← 0.0 0.8 · max 3, 1 , 3, 42, 3 ← 0.0 0.8 · max 3, 1 , 3, 4
2, 3 ← 0.0 0.8 · max 0 , 0 02, 3 ← 0.0 0.8 · max 0 , 0 0
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 100
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Q-LEARNING
EXAMPLE WALKTHROUGH
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 100
2 0 0 0 0 0 0
3 0 80 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
3, 1 ← 0.0 0.8 · max 1, 5 , 1, 33, 1 ← 0.0 0.8 · max 1, 5 , 1, 3
3, 1 ← 0.0 0.8 · max 100 , 0 803, 1 ← 0.0 0.8 · max 100 , 0 80
80
41. 41
Q-LEARNING
EXAMPLE WALKTHROUGH
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
Select Choice: (2, 3)
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 100
2 0 0 0 0 0 0
3 0 80 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
Q-LEARNING
EXAMPLE WALKTHROUGH
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
2, 3 ← 0.0 0.8 · max 3, 1 , 3, 42, 3 ← 0.0 0.8 · max 3, 1 , 3, 4
2, 3 ← 0.0 0.8 · max 80 , 0 642, 3 ← 0.0 0.8 · max 80 , 0 64
0 1 2 3 4 5
0 0 0 0 0 0 0
1 0 0 0 0 0 100
2 0 0 0 64 0 0
3 0 80 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
64
42. 42
Q-LEARNING
EXAMPLE WALKTHROUGH
Q-MATRIX
REWARDS
0 to 4, 4 to 0 0 1 to 5 100
3 to 4, 4 to 3 0 4 to 5 100
2 to 3, 3 to 2 0 5 to 5 100
3 to 1, 1 to 3 0
2
10
4
3
5
5
0 1 2 3 4 5
0 0 0 0 0 80 0
1 0 0 0 64 0 100
2 0 0 0 64 0 0
3 0 80 51 0 80 0
4 64 0 0 64 0 100
5 0 80 0 0 80 100
After many episodes…
Use Q-Values to select actions
Q-LEARNING: AI FOR TESTING
APPROACH
html
head body
title pdiv
font-size: 16px
Hello Worldimg
font-size : 16px
font-weight: bold
Compute Render Trees
AIT Test Case
Element/Screen Classifiers
Application Graph
Step Actions + Verifications
43. 43
GENERATING TEST ACTIONS
HOW BOTS LEARN TO PERFORM TEST ATTACKS
PERCEIVE
What can we interact with?
ACT
ML determines action
LEARN
Feedback trains brain
Artificial Neural Network
Input Hidden Output
test@example.com’1 = 1 --
VALIDATING OUTPUT
HOW BOTS LEARN TO DETECT BUGS
PERCEIVE
What can we interact with?
ACT
ML determines action
LEARN
Feedback trains brain
Artificial Neural Network
Input Hidden Output
45. 45
LOOSELY INSPIRED BY BIOLOGY
ARTIFICIAL NEURAL NETWORKS
Human Brain
15 - 33 Billion Neurons Biological Neuron
Artificial Neuron
ARTIFICIAL NEURON
A perceptron is an algorithm for supervised learning of binary classifiers.
A SINGLE-LAYER PERCEPTRON
46. 46
ARTIFICIAL NEURON
At its core, it is a function that maps inputs to outputs.
A SINGLE-LAYER PERCEPTRON
ARTIFICIAL NEURONA SIMPLE NEURAL NETWORK
“A feed-forward network with a single layer is sufficient
to represent any function…”
Ian Goodfellow
47. 47
A SINGLE-LAYER PERCEPTRON: LOSS FUNCTION
ARTIFICIAL NEURON
Given examples,
find weights that map
inputs to outputs.
Initially, weights are
randomly initialized.
Value of predicted output
may be different from the
actual output .
A LOSS function is used to
measure this difference.
HOW DO ARTIFICIAL NEURAL NETWORKS LEARN?
FORWARD-PROPAGATION
TRAINING NEURAL NETWORKS
Hidden LayersInput Layer Output Layer
LOSS
, ,
EVALUATION
49. 49
TENSORFLOW PLAYGROUND
NEURAL NETWORKS IN ACTION
https://playground.tensorflow.org
FEED-FORWARD
CONVOLUTIONAL
RECURRENT
LONG SHORT-TERM MEMORY
TYPES OF NEURAL NETWORKS
DEEP LEARNING
50. 50
LEARNING FROM EXISTING TESTS
TEST GENERATION FROM ABSTRACT TEST FLOWS
ABSTRACT TEST
FLOW LANGUAGE
ABSTRACT TEST
FLOW LANGUAGE
LONG SHORT-TERM MEMORY RECURRENT NEURAL NETWORK
https://machinelearningmastery.com
JASON BROWNLEE
51. 51
TEXT GENERATION WITH
LONG SHORT-TERM MEMORY
RECURRENT NEURAL NETWORKS
IN PYTHON WITH KERAS
https://machinelearningmastery.com/text-generation-lstm-recurrent-neural-networks-python-keras/
52. 52
Freely downloadable and usable for
machine learning experiments.
www.gutenberg.org
~150,000 Characters
Total in the book
47 Distinct Characters
When converted to lowercase
100-Length Subsequence Training
N-Length Subsequence → Character Output
CHAPT → E
HAPTE → R
Example (N=5)
53. 53
be no mistake about it: it was
neither more nor less than a pig,
and she felt that it would be quit
e aelin that she was a little want oe
toiet ano a grtpersent to the tas a
little war th tee the tase oa teettee the
had been tinhgtt a little toiee at the
cadl in a long tuiee aedun thet sheer
was a little tare gereen to be a gentle
of the tabdit soenee the gad ouw ie
the tay a tirt of toiet at the was a
little anonersen, and thiu had been
woite io a lott of tueh a tiie and
taede bot her aeain she cere thth the
bene tith the tere bane to tee toaete to
tee the harter was a little tire the
same oare cade an anl ano the garee
and the was so seat the was a little
gareen and the sabdit, and the
white rabbit wese tilel an the caoe
and the sabbit se teeteer, and the
white rabbit wese tilel an the cade in
a lonk tfne the sabdi ano aroing to
tea the was sf teet whitg the was a
little tane oo thete the sabeit she
was a little tartig to the tar tf tee
the tame of the cagd, and the white
rabbit was a little toiee to be anle
tite thete ofs and the tabdit was the
wiite rabbit, and
256 Memory Units, 1 Hidden Layer
gooder head. and said to herself, ‘it
was a little little shated of the
mouse of the good of the courte, and
it was a little little shated in a little
that the was a little little shated of
the thmee said to see it was a little
book of the was a little that she was
so sereated to hare a little the began
sitee of the was of the was a little
that she was so seally and the
sabbit was a little lad good to the
little gooder head of the gad seared
to see it was a little lad good to the
little good
256 Memory Units, 2 Hidden Layers
herself lying on the bank, with her
head in the lap of her sister, who was
gently brushing away so siee, and
she sabbit said to herself and the
sabbit said to herself and the sood
way of the was a little that she was
a little lad good to the garden, and
the sood of the mock turtle said to
herself, 'it was a little that the mock
turtle said to see it said to sea it
said to sea it say it the marge hard
sat hn a little that she was so
sereated to herself, and she sabbit
said to herself, 'it was a little little
shated of the sooe of the coomouse it
was a little lad good to the little
54. 54
LEARNING FROM EXISTING TESTS
test.ai
Observe ErrorMessage
IF
Perceived Conditions
Input BLANK FirstName Invoke SubmitObserve Required TextBox FirstName
First Name* Last Name*
Company
ABSTRACT TEST FLOW LANGUAGE
A Model-Based AI-Driven Test Generation System, Dionny Santiago.
Masters Thesis Proposal, Florida International University (2018).
LEARNING FROM EXISTING TESTS
test.ai
Observe ErrorMessage
IF
Perceived Conditions
WHEN
Input Actions
Input BLANK FirstName Invoke SubmitObserve Required TextBox FirstName
First Name* Last Name*
Company
ABSTRACT TEST FLOW LANGUAGE
A Model-Based AI-Driven Test Generation System, Dionny Santiago.
Masters Thesis Proposal, Florida International University (2018).
55. 55
LEARNING FROM EXISTING TESTS
Observe ErrorMessage
IF
Perceived Conditions
WHEN
Input Actions
THEN
Required Observations
Input BLANK FirstName Invoke SubmitObserve Required TextBox FirstName
First Name* Last Name*
Company
Please enter first name. Please enter last name.
ABSTRACT TEST FLOW LANGUAGE
A Model-Based AI-Driven Test Generation System, Dionny Santiago.
Masters Thesis Proposal, Florida International University (2018).
LEARNING FROM EXISTING TESTS
GRAMMAR FOR ABSTRACT TEST FLOW LANGUAGE
<flow> ::= <observation-list> <component-action-list> <observation-list>
<observation-list> ::= <observation> ‘ ’ <observation-list> | <observation>
<observation> ::= ‘Observe’ <qualifier-list> <component> | ‘NotObserve’ <qualifier-list> <component>
<qualifier-list> ::= <qualifier> ‘ ’ <qualifier-list> | <qualifier> | ‘’
<qualifier> ::= ‘Required’ | <learned-qualifier>
<component> ::= <element-class> <ident> | <ident>
<component-action-list> ::= <component-action> ‘ ’ <component-action-list> | <component-action>
<component-action> ::= ‘Input’ <equivalence-class> <component> | ‘Invoke’ <element-class>
<equivalence-class> ::= “VALID’ | ‘BLANK’ | ‘WHITESPACE’ | <learned-eq-class>
<element-class> ::= ‘Textbox’ | ‘Dropdown’ | ‘ErrorMessage’ | ‘Submit’ | ‘Cancel’ | <learned-el-class>
<learned-qualifier> ::= <ident>
<learned-eq-class> ::= <ident>
<learned-el-class> ::= <ident>
A Model-Based AI-Driven Test Generation System, Dionny Santiago, Masters Thesis Proposal, Florida International University (2018).
56. 56
LEARNING FROM EXISTING TESTS
PREPARING TRAINING DATA
Input Sentence Predicted Next Word
Perceive Required
Perceive Required Textbox
Perceive Required Textbox FirstName
Perceive Required Textbox FirstName Input
Perceive Required Textbox FirstName Input VALID
Perceive Required TextBox FirstName Input VALID FirstName Invoke
Perceive Required TextBox FirstName Input VALID FirstName Invoke Submit
Perceive Required TextBox FirstName Input VALID FirstName Invoke Submit NotObserve
Perceive Required Textbox FirstName Input VALID FirstName Invoke Submit NotObserve ErrorMessage
A Model-Based AI-Driven Test Generation System, Dionny Santiago.
Masters Thesis Proposal, Florida International University (2018).
LEARNING FROM EXISTING TESTS
TEST GENERATION FROM ABSTRACT TEST FLOWS
57. 57
LEARNING FROM EXISTING TESTS
SAMPLE RESULTS FROM TEST FLOW SENTENCE TRAINING
Loss
2.9
0.5
A Model-Based AI-Driven Test Generation System, Dionny Santiago.
Masters Thesis Proposal, Florida International University (2018).
LEARNING FROM EXISTING TESTS
SAMPLE RESULTS FROM TEST FLOW SENTENCE TRAINING
Executed Query: Perceive Required TextBox FirstName
ML leverages
the trained
model to fill in
next steps.
At first it sucks!
Loss
2.9
0.5
But then it
gets better.
58. 58
LEARNING FROM EXISTING TESTS
SAMPLE RESULTS FROM TEST FLOW SENTENCE TRAINING
Most importantly it generalizes…
This fragment did not appear in training set.
NEURAL NETS IN PRACTICE
PROGRAMMING FRAMEWORKS
60. 60
EXECUTING TEST FLOWS
TRACKING AS BOTS STEP THROUGH THE APPLICATION
BENEFITS OF AI-DRIVEN TESTING
PESTICIDE FREE
Generates New Tests Each Time
Eliminates Pesticide Paradox
GENERAL PURPOSE
Different Testing Types
Any Application or Domain
LARGE SCALE
Deep Learning
Cloud Infrastructure
61. 61
BAYES’ THEOREM: INTRODUCTION
BAYESIAN NETWORKS
Conditional probability is the probability of an event
happening, given that it has some relationship to
one or more other events.
FINDING AN OPEN PARKING SPACE ?
BAYESIAN NETWORKS
BAYES’ THEOREM: INTRODUCTION
62. 62
Conditional probability is the probability of an event
happening, given that it has some relationship to
one or more other events.
BAYESIAN NETWORKS
BAYES’ THEOREM: INTRODUCTION
TIME OF DAYLOCATION EVENTS
BAYES’ THEOREM
BAYESIAN NETWORKS
: GRAPHICAL MODELING
SMOKERSMOKER
LUNG
DISEASE
LUNG
DISEASE
SHORTNESS
OF BREATH
SHORTNESS
OF BREATH
CHEST
PAIN
CHEST
PAIN COUGHCOUGH FEVERFEVER
COLDCOLD
64. 64
FUTURE TRENDS
ENHANCE
PORTIONS OF EXISTING
TESTING TOOLS
REPLACE
ENTIRE TOOL STACKS
BUT NEED HUMAN INPUT
TAKE OVER
HUMAN ACTIVITY AFTER
LEARNING OVER TIME
67. 67
The AI for testing problem, and testing in
general, is too important and large of a problem
for any one company or effort to solve, and
hence we formed an association around it.
www.aitesting.org