how king uses ai to test candy crush saga€¦ · l 4 king qa roles •atl –agile testing lead...

41
How King uses AI to test Candy Crush Saga Alexander Andelkovic

Upload: others

Post on 22-May-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

How King uses AI to test Candy Crush Saga

Alexander Andelkovic

Page 2: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

2

King

• Founded 2003

• +200 Games

• 2000 employees

• 11 Locations (Stockholm, London, Barcelona,

Berlin, Malmö, Bucharest, San Francisco,

Chicago, Los Angeles, New York, Malta )

• 258 million monthly active users (Q2 2019)

• Acquired by Activision/Blizzard (2016-02-23)

Page 3: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Major Franchises

3

Page 4: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

4

King QA roles

• ATL – Agile Testing Lead

• QA Analyst – Exploratory tester

• QRT – Quick Regression Team

• TAE – Test Automation Engineer

• DS – Data Scientist

• Developer – (Frontend/Backend)

Page 5: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

5

BAIT – Bot for AI-based

Testing

BAIT is a test automation

bot powered by AI

Page 6: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

6

How does BAIT work?

Bait explores game by

● Taking screenshots

● Uses AI to find button

coordinates

● Click detected buttons

● Performs AI powered

verifications

Page 7: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

BAIT workflow

7

Page 8: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Button detection – AI model training

8

Page 9: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Button detection – Mask R-CNN

9

Mask models

• Close button

• Other button

Instance Segmentation

Page 10: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Button detection – image segmentation and thresholding

10

Color shareholding

• Associate each pixel with black or

white according to a threshold(rgb

value)

Otsu’s Binarization

• Filter to remove noise in an image

Page 11: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

11

Button detection - Result

Page 12: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection – Image hash similarity

12

1.Generate image fingerprint with perceptual hash algorithm (p-

hash)

P-hash( ) = 8a0303f6df3ec8cd

P-hash( ) = 8c011456ef9eadcc

2.Euclidean distance algorithm used to compute the

similarity(distance) of the two hash values.

Page 13: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection – Euclidean Distance

13

= Euclidean Distance

3. Similarity range 0 = Similar, <6 minor difference, >6 different

4.Compare two images fingerprint, if they are similar by a threshold(<6)

then considered same image

Page 14: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection – Text similarity

14

1. Screen parsed by Google vision API for text

2. tfidf vectorizer(word count, !word frequency)used to generate matrix of

text input

Text from image 1: “Buy the Gold Bars and give the Piggy Bank”

Text from image 2 : “Piggy Bank!”

Text mining results(tfidf matrixes):

Cosine similarity = 0.3

TextTerm Buy Gold Bars give Piggy Bank

Text 1 0.3160 0.2248 0.3160 0.3160 0.2248 0.6320

Text2 0 0 0 0 0.7071 0.7071

Page 15: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection – Cosine Similarity

15

= Cosine Similarity

3.Cosine similarity algorithm used to calculate distance(0-1) between two

vectors and in our case if distance >0.6 text considered similar

“Piggy Bank!”

“Buy the Gold Bars and give the Piggy Bank”

Page 16: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

1 2 3

Similarity detection – Hash & Text similarity

16

Image Hash similar = similar Image Hash not similar but text similar =

similar

Image Hash not similar and text not similar = not

similar

Page 17: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection results

17

Moving features(animation

glitches)

Page 18: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection results

18

Miss-aligned

features(bug)

Page 19: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection results

19

Same screen, different

backgrounds(threshold)

Page 20: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Similarity detection results

20

Overlapping menus(new

state)

Page 21: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Game Graph

21

Page 22: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Game Graph +4500 levels

22

Page 23: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

BAIT - Game console commands

23

• Win/Loose <level>

• Progress <level>

• Unlock <feature>

• Access

<facebook_user_token>

Page 24: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

BAIT – Missing texture detection

24

Convert image RGB

to only keep Green

channel

Thresholding - Pixels close

to black set to white rest set

to black

Contour finding

algorithm used to find

contours

1 2 3

Page 25: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

BAIT – Missing texture detection

25

OpenCV functions used

1. findContours() used to find

all contours

2. contourArea() used to

calculate contour area and if

below certain threshold it’s

filtered out

Page 26: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Example - Missing textures

26

Page 27: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Example - Missing texts

27

Page 28: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Overlapping objects

28

Text covered by

buttons

Text does not fit

button

Page 29: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

BAIT Quiz – Can you find the bug?

29

Page 30: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Game Rendering bug

30

Page 31: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Game Rendering bug – thresholding used for detection

31

Page 32: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

BAIT Requirements

32

Desktop

GET automation/screenshot/<filename>

GET automation/tap/<x>/<y>

GET automation/level/win

GET automation/fbuser

Mobile

GET automation/level/win

GET automation/fbuser

Page 33: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Click BAIT - Overview

33

• BAIT frontend

• Run scheduled BAIT jobs

• BAIT statistics

Page 34: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Click BAIT - Dashboard

34

Page 35: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Click BAIT - Create BAIT job

35

Page 36: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Click BAIT – Bait jobs scheduler

36

Page 37: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

Click BAIT - Statistics

37

Page 38: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

BAIT Demo

38

Page 39: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

39

Summary - What can BAIT help out

with?

● Crashes

● Text bugs

● Missing textures

● Audio errors

Page 40: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

© K

ing

.co

m L

td 2

01

9 -

Co

mm

erc

ially

Co

nfid

en

tia

l

40

Questions?

alexander.andelkovic@king.

com

king.com/jobs

Page 41: How King uses AI to test Candy Crush Saga€¦ · l 4 King QA roles •ATL –Agile Testing Lead •QA Analyst –Exploratory tester •QRT –Quick Regression Team •TAE –Test