GTAC 2014 - Test automation on an infrared set-top box

56
Test Automation on an infrared Set-top box Olivier ETIENNE - Orange

Transcript of GTAC 2014 - Test automation on an infrared set-top box

Page 1: GTAC 2014 - Test automation on an infrared set-top box

Test Automation on an infrared Set-top box

Olivier ETIENNE - Orange

Page 2: GTAC 2014 - Test automation on an infrared set-top box

What is a STB

a Set Top Box ?

Basically just a device to manage IP TV and associated services

Tuner

TNTHDD

RAM CPU

Network adapter

Drivers

Native

SDK

IR Radio

Video card

OS (Linux ou Android)

SDK

HTML

Javascript

Browser…

Page 3: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

OS (Linux ou Android)

SDK

HTML

Javascript

Browser

Page 4: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

OS (Linux ou Android)

SDK

HTML

Javascript

Browser

Page 5: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

Page 6: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

Page 7: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

Page 8: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

Page 9: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

A Browser

(Webkit)

Page 10: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

A Browser

(Webkit)

HTML

pages

Page 11: GTAC 2014 - Test automation on an infrared set-top box

La STB… pour faire simple

A Browser

(Webkit)

HTML

pages

But all

interactions

made via

remote control

Page 12: GTAC 2014 - Test automation on an infrared set-top box

Many countries

FrancePoland SpainSenegal

Many versions for each countries

Maintenance Evolutive

Many devices

Sagem Samsung Airties

Page 13: GTAC 2014 - Test automation on an infrared set-top box

So many devices…

Page 14: GTAC 2014 - Test automation on an infrared set-top box

How would you test

your TV app ?

Page 15: GTAC 2014 - Test automation on an infrared set-top box

Test

Status

How would you test your TV app ?

Page 16: GTAC 2014 - Test automation on an infrared set-top box

TEST1 sprint =

Accuracy

relative to

tester

Boring

Activity

Many tests

DEV DEV DEV

• Impossible to test everything

• Not confident in what has been tested

• Non regression test are expensive

• Fear to make any change in code

How would you test your TV app ?

Page 17: GTAC 2014 - Test automation on an infrared set-top box

We need to

automate that !

Page 18: GTAC 2014 - Test automation on an infrared set-top box

Automation objectives

• Reduce test campaign duration–non regression tests

–functional tests

• Get confident in refactorings

• Use target environnement

• Make reproductible tests

Low

cost

Easy

to use

Page 19: GTAC 2014 - Test automation on an infrared set-top box

Previous experiences

• Witbe

• TAKT Engine

• STB-tester

ExpensiveHard to maintain testSensitive to UI change

• Record IR signal

• Send IR signal

• Video capture and analysis

• Expensive hardware

Page 20: GTAC 2014 - Test automation on an infrared set-top box

A different approach

Page 21: GTAC 2014 - Test automation on an infrared set-top box

Infrared

Automate, automate, but… how ?

OrangeTV

12:32

?

Page 22: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

Infrared

Page 23: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

Infrared

RPi

Page 24: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

Infrared

RPi

OUT: send IR IN : regIR

Page 25: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

OUT: send IR IN : regIR

Page 26: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

IN : sendKey

IN : runSequence

OUT: send IR IN : regIR

Page 27: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

Page 28: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

Page 29: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

Page 30: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

Page 31: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IR Signal

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

Page 32: GTAC 2014 - Test automation on an infrared set-top box

Raspberry pi as a mediator

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IR Signal

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

Page 33: GTAC 2014 - Test automation on an infrared set-top box

DOM

Raspberry pi as a mediator

OrangeTV

12:32

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IR Signal

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

Page 34: GTAC 2014 - Test automation on an infrared set-top box

DOM

Raspberry pi as a mediator

OrangeTV

12:32

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IR Signal

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

DOM

Page 35: GTAC 2014 - Test automation on an infrared set-top box

DOM

Raspberry pi as a mediator

OrangeTV

12:32

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IR Signal

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

DOM

Page 36: GTAC 2014 - Test automation on an infrared set-top box

DOM

Raspberry pi as a mediator

OrangeTV

12:32

IN : readIR OUT: sendIR

HTTP

Infrared

RPi

GET HTTP

IR Signal

Synchronous

HTTP

response

IN : sendKey

IN : runSequence

IN : readDump

OUT: send IR IN : regIR

DOM

Page 37: GTAC 2014 - Test automation on an infrared set-top box

Pimp my Pi

Raspberry Pi

Apache

PH

P

Scripts

SH

Java

GPIO

Driver

LIRC

HT

TP

Send a key

Record a keypi4j

screen

Page 38: GTAC 2014 - Test automation on an infrared set-top box

Screenshot or dump

RPi

Start Sequence

OrangeTV

12:32

PC

(Browser)

TV

Page 39: GTAC 2014 - Test automation on an infrared set-top box

Video 1:Record an infrared sequence and replay it from firefox

Page 40: GTAC 2014 - Test automation on an infrared set-top box

From specific to

standard

Page 41: GTAC 2014 - Test automation on an infrared set-top box

Screenshot or dump

« Screenshot »

of the STB

Content

DOM

« Screenshot »

of the STB

Content

Page 42: GTAC 2014 - Test automation on an infrared set-top box

Selenium IDE

TestSuite

TestCaseSend orders

to STB

Make

assertions

on state

Page 43: GTAC 2014 - Test automation on an infrared set-top box

Video 2 :Replay a sequence from Selenium IDE

Page 44: GTAC 2014 - Test automation on an infrared set-top box

interne Orange44

HTTP

IN : sendKey

IN : runSequence

IN : askDump

IN : runShellCmd

IN : softReboot

IN : hardReboot

RPi

Call HTTP verbs

Make assertions

A raspberry pi as an HTTP proxy to the STB

OrangeTV

12:32

Page 45: GTAC 2014 - Test automation on an infrared set-top box

Why Selenium IDE ???

• Quite as good as Selenium

• But much simpler

– Simplified script language

– Firefox Plugin

• No need to be a developer to write a test

Page 46: GTAC 2014 - Test automation on an infrared set-top box

every night

Big pictureOn demand

Code

Repo

updateTestSuitesdeploy

updatereset

selenium

Delivery

Status

Test

Repo

Page 47: GTAC 2014 - Test automation on an infrared set-top box

Results

Page 48: GTAC 2014 - Test automation on an infrared set-top box

Results

• First prototype developed in 4 weeks

• Over 300 functional tests running every night

• VOD tests takes 3h in the night instead of 5

working days

• Team has gained

– confidence in its code

– a better image

Page 49: GTAC 2014 - Test automation on an infrared set-top box

Lessons learned

• Keep control on your test data

• Think test soon

– when you write specs

– when you design your architecture

– when you code

• Simple is better

• Everything can’t be automated

Page 50: GTAC 2014 - Test automation on an infrared set-top box

And now, …

how do you test

your TV app ?

Page 51: GTAC 2014 - Test automation on an infrared set-top box

Like this !

Page 52: GTAC 2014 - Test automation on an infrared set-top box

Questions ?

Page 53: GTAC 2014 - Test automation on an infrared set-top box

Olivier [email protected]://linkedin.com/profile/view?id=7988978@olivier_etienne

Contact

Page 54: GTAC 2014 - Test automation on an infrared set-top box

Bonus slide : What kind of interaction does the

pi provides with STB

❏ send a key

❏ send a key sequence

❏ ask a screen dump

❏ wait for a specific screen to be visible

❏ execute a shell command on the stb

❏ upload and execute a sheel script on stb

❏ put a file on stb

❏ get a file on stb

❏ get logs from stb console

❏ wait for specific log

❏ …

All these verbs are exposed through HTTP interface of the raspberry pi

Page 55: GTAC 2014 - Test automation on an infrared set-top box

Bonus slide : What can you retrieve on test failure

❏ Logs from STB Console

❏ Screen dump

Available through selenium execution report in Jenkins

Page 56: GTAC 2014 - Test automation on an infrared set-top box

Bonus slide : What is java used for

Java is used for the key sequence recorder and player.

It support a script language

KEY_PRESS

WAIT

REPEAT

:

KEY_RANDOM

DUMP_SCREEN