ipc2008 slide qa in depth best practises

350
Quality Assurance in PHP Projects In-Depth Best-Practises

Upload: ahmed-samir

Post on 15-Apr-2017

251 views

Category:

Education


0 download

TRANSCRIPT

Page 1: Ipc2008 Slide Qa In Depth Best Practises

Quality Assurance in PHP Projects

In-Depth Best-Practises

Page 2: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 2

Who are we?

•  Max Horváth

•  Actively involved in web development for the past 10 years.

•  Quality Manager at studiVZ Ltd.

Page 3: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 3

Who are we?

•  Wojciech Duda

•  Involved in software testing for the past 6 years.

•  QA Engineer at studiVZ Ltd.

Page 4: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 4

Who are YOU?

•  What is your experience with: •  QA in PHP projects?

•  Metrics of software?

•  Testing of software?

Page 5: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 5

Schedule

Page 6: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 6

Schedule / Lots of coffee

•  10:45am – 11:15am Coffee Break

•  12:15am – 01:30pm Lunch

•  03:15pm – 03:45pm Coffee Break

Page 7: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 7

Schedule (Part I)

•  09:30am – 10:00am Intro / Tutorial

•  10:45am – 11:15am Coffee Break

•  11:15am – 12:15am Tutorial

•  12:15am – 01:30pm Lunch

Page 8: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 8

Schedule (Part II)

•  01:30pm – 02:30pm Tutorial

•  03:15pm – 03:45pm Coffee Break

•  03:45pm – 05:00pm Q&A

Page 9: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 9

Objectives of this workshop

•  To introduce you to the quality assurance process and key quality assurance activities

Page 10: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 10

Objectives of this workshop

•  To introduce you to the quality assurance process and key quality assurance activities

•  To explain the role of standards in quality assurance

Page 11: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 11

Objectives of this workshop

•  To explain the concept of a software metric, predictor metrics and control metrics

Page 12: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 12

Objectives of this workshop

•  To explain the concept of a software metric, predictor metrics and control metrics

•  To explain how measurement may be used in assessing software quality

Page 13: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 13

Topics covered

•  Quality assurance and standards

Page 14: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 14

Topics covered

•  Quality assurance and standards

•  Quality planning

Page 15: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 15

Topics covered

•  Quality assurance and standards

•  Quality planning

•  Quality control

Page 16: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 16

Topics covered

•  Quality assurance and standards

•  Quality planning

•  Quality control

•  Software measurement and metrics

Page 17: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 17

What is Quality Assurance?

•  QA is part of all good production processes.

Page 18: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 18

What is Quality Assurance?

•  QA is part of all good production processes.

•  Quality Assurance (QA) is part of the process that ensures:

Page 19: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 19

What is Quality Assurance?

•  QA is part of all good production processes.

•  Quality Assurance (QA) is part of the process that ensures: •  quality in work

Page 20: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 20

What is Quality Assurance?

•  QA is part of all good production processes.

•  Quality Assurance (QA) is part of the process that ensures: •  quality in work

•  activities are being performed effectively

Page 21: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 21

What is Quality Assurance?

•  QA is part of all good production processes.

•  Quality Assurance (QA) is part of the process that ensures: •  quality in work

•  activities are being performed effectively

•  the product meets requirements

Page 22: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 22

What is Quality Assurance?

•  Involves defining appropriate quality standards and procedures and ensuring that these are followed

Page 23: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 23

What is Quality Assurance?

•  Involves defining appropriate quality standards and procedures and ensuring that these are followed

•  Should aim to develop a ‘quality culture’ where quality is seen as everyone’s responsibility

Page 24: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 24

What is quality?

•  Quality, simplistically, means that a product should meet its specification

Page 25: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 25

What is unique about Software QA?

Page 26: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 26

What is unique about Software QA?

Page 27: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 27

What is unique about Software QA?

!=

Page 28: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 28

It is not equal

•  Software QA has some differences:

Page 29: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 29

It is not equal

•  Software QA has some differences: •  Functions, benefits and production costs are not as

easily measured as a physical product.

Page 30: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 30

It is not equal

•  Software QA has some differences: •  Functions, benefits and production costs are not as

easily measured as a physical product.

•  When a software product is delivered, it is not necessarily complete ... it lives, it evolves, it gets updated.

Page 31: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 31

It is not equal

•  Software QA has some differences: •  Functions, benefits and production costs are not as

easily measured as a physical product.

•  When a software product is delivered, it is not necessarily complete ... it lives, it evolves, it gets updated.

•  Finished is a term applied for the purpose of releasing it for use.

Page 32: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 32

It is not equal

•  Software QA has some differences: •  Functions, benefits and production costs are not as

easily measured as a physical product.

•  When a software product is delivered, it is not necessarily complete ... it lives, it evolves, it gets updated.

•  Finished is a term applied for the purpose of releasing it for use.

•  Software specifications are usually incomplete and often inconsistent

Page 33: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 33

The challenge

•  Processes and methods to manage, monitor, and measure quality in web applications can be as fluid and elusive as the defects they are meant to keep in check.

Page 34: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 34

The challenge

•  Processes and methods to manage, monitor, and measure quality in web applications can be as fluid and elusive as the defects they are meant to keep in check.

•  For processes and methods to be most effective, you need to implement both standards and company guidelines.

Page 35: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 35

Quality Assurance is not limited to Quality Control

•  Testing is an essential part of QA

Page 36: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 36

Quality Assurance is not limited to Quality Control

•  Testing is an essential part of QA

•  But QA tests the entire process:

Page 37: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 37

Quality Assurance is not limited to Quality Control

•  Testing is an essential part of QA

•  But QA tests the entire process: •  Your development process / efficiency

Page 38: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 38

Quality Assurance is not limited to Quality Control

•  Testing is an essential part of QA

•  But QA tests the entire process: •  Your development process / efficiency

•  Functional accuracy of your software releases

Page 39: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 39

Quality Assurance is not limited to Quality Control

•  Testing is an essential part of QA

•  But QA tests the entire process: •  Your development process / efficiency

•  Functional accuracy of your software releases

•  Ideally preventing future software defects

Page 40: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 40

The benefits of QA

•  Improved client satisfaction:

Page 41: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 41

The benefits of QA

•  Improved client satisfaction: •  profitable relationships

Page 42: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 42

The benefits of QA

•  Improved client satisfaction: •  profitable relationships

•  good testimonials

Page 43: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 43

The benefits of QA

•  Improved client satisfaction: •  profitable relationships

•  good testimonials

•  waves of referrals

Page 44: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 44

The benefits of QA

•  Reduced cost of development:

Page 45: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 45

The benefits of QA

•  Reduced cost of development: •  fewer defects

Page 46: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 46

The benefits of QA

•  Reduced cost of development: •  fewer defects

•  streamlined and simplified stages of development

Page 47: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 47

The benefits of QA

•  Reduced cost of development: •  fewer defects

•  streamlined and simplified stages of development

•  retesting runs smoothly

Page 48: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 48

The benefits of QA

•  Reduced cost of development: •  fewer defects

•  streamlined and simplified stages of development

•  retesting runs smoothly

•  deployment on time

Page 49: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 49

The benefits of QA

•  Reduced cost of development: •  fewer defects

•  streamlined and simplified stages of development

•  retesting runs smoothly

•  deployment on time

•  on budget

Page 50: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 50

The benefits of QA

•  Reduced cost of maintenance:

Page 51: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 51

The benefits of QA

•  Reduced cost of maintenance: •  good development is less troublesome to support

Page 52: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 52

The benefits of QA

•  Reduced cost of maintenance: •  good development is less troublesome to support

•  support is costly

Page 53: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 53

Quality Assurance activities

•  Quality management

Page 54: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 54

Quality Assurance activities

•  Quality management •  Establish organizational procedures and standards for

quality

Page 55: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 55

Quality Assurance activities

•  Quality management •  Establish organizational procedures and standards for

quality

•  Quality planning

Page 56: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 56

Quality Assurance activities

•  Quality management •  Establish organizational procedures and standards for

quality

•  Quality planning •  Select applicable procedures and standards for a

particular project and modify these as required

Page 57: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 57

Quality Assurance activities

•  Quality management •  Establish organizational procedures and standards for

quality

•  Quality planning •  Select applicable procedures and standards for a

particular project and modify these as required

•  Quality control

Page 58: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 58

Quality Assurance activities

•  Quality management •  Establish organizational procedures and standards for

quality

•  Quality planning •  Select applicable procedures and standards for a

particular project and modify these as required

•  Quality control •  Ensure that procedures and standards are followed by

the software development team

Page 59: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 59

Quality Assurance activities

•  Important:

Page 60: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 60

Quality Assurance activities

•  Important: •  Quality management should be separate from project

management to ensure independence

Page 61: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 61

Quality assurance and standards

•  Standards are the key to effective quality management

Page 62: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 62

Quality assurance and standards

•  Standards are the key to effective quality management

•  They may be international, national, organizational or project standards

Page 63: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 63

Quality assurance and standards

•  Product standards define characteristics that all components should exhibit e.g. a common programming style

Page 64: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 64

Quality assurance and standards

•  Product standards define characteristics that all components should exhibit e.g. a common programming style

•  Process standards define how the software process should be enacted

Page 65: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 65

Importance of standards

•  Encapsulation of best practice - avoids repetition of past mistakes

Page 66: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 66

Importance of standards

•  Encapsulation of best practice - avoids repetition of past mistakes

•  Framework for quality assurance process - it involves checking standard compliance

Page 67: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 67

Importance of standards

•  Encapsulation of best practice - avoids repetition of past mistakes

•  Framework for quality assurance process - it involves checking standard compliance

•  Provide continuity - new staff can understand the organization by understand the standards applied

Page 68: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 68

Problems with standards

•  Not seen as relevant and up-to-date by software engineers

Page 69: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 69

Problems with standards

•  Not seen as relevant and up-to-date by software engineers

•  Involve too much bureaucratic form filling

Page 70: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 70

Problems with standards

•  Not seen as relevant and up-to-date by software engineers

•  Involve too much bureaucratic form filling

•  Unsupported by software tools so tedious manual work is involved to maintain standards

Page 71: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 71

Testing in PHP Projects

•  Testing is one of the most important tasks of QA.

Page 72: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 72

Testing in PHP Projects

•  Testing is one of the most important tasks of QA.

•  We are going to talk about these testing techniques and tools:

Page 73: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 73

Testing in PHP Projects

•  Testing is one of the most important tasks of QA.

•  We are going to talk about these testing techniques and tools: •  Unit Tests (PHPUnit)

Page 74: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 74

Testing in PHP Projects

•  Testing is one of the most important tasks of QA.

•  We are going to talk about these testing techniques and tools: •  Unit Tests (PHPUnit)

•  Continuous Integration (phpUnderControl)

Page 75: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 75

Testing in PHP Projects

•  Testing is one of the most important tasks of QA.

•  We are going to talk about these testing techniques and tools: •  Unit Tests (PHPUnit)

•  Continuous Integration (phpUnderControl)

•  Software Metrics (PHPUnit / PHP_CodeSniffer)

Page 76: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 76

Testing in PHP Projects

•  Testing is one of the most important tasks of QA.

•  We are going to talk about these testing techniques and tools: •  Unit Tests (PHPUnit)

•  Continuous Integration (phpUnderControl)

•  Software Metrics (PHPUnit / PHP_CodeSniffer)

•  Acceptance Tests (PHPUnit / Selenium)

Page 77: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 77

Testing Types

•  Unit Tests

Page 78: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 78

Testing Types

•  Unit Tests •  Executable code fragments test the correctness of

parts – units – of the software (system under test).

Page 79: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 79

Testing Types

•  Unit Tests •  Executable code fragments test the correctness of

parts – units – of the software (system under test).

•  System / Integration Tests

Page 80: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 80

Testing Types

•  Unit Tests •  Executable code fragments test the correctness of

parts – units – of the software (system under test).

•  System / Integration Tests •  Conducted on a complete, integrated system to

evaluate the system's compliance with ist specified requirements.

Page 81: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 81

Testing Types

•  Non-Functional Tests

Page 82: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 82

Testing Types

•  Non-Functional Tests •  Test of performance, stability or security of

application.

Page 83: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 83

Testing Types

•  Non-Functional Tests •  Test of performance, stability or security of

application.

•  Acceptance Tests

Page 84: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 84

Testing Types

•  Non-Functional Tests •  Test of performance, stability or security of

application.

•  Acceptance Tests •  Ensure that the code does what the customer wants.

Page 85: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 85

Testing Tools

•  To make testing viable, good tool support is needed.

Page 86: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 86

Testing Tools

•  To make testing viable, good tool support is needed.

•  This is where a testing framework such as PHPUnit comes into play.

Page 87: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 87

Testing Tools

•  Unit Tests •  PHPUnit

•  PHPT

•  SimpleTest

Page 88: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 88

Testing Tools

•  Acceptance Tests •  Selenium Suite

•  Selenium Remote Control •  PHPUnit to talk Selenese to Selenium RC

Page 89: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 89

Testing Tools

•  Non-Functional Tests •  Performance Tests

•  ab •  Apache JMeter

Page 90: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 90

Testing Tools

•  Non-Functional Tests •  Performance Tests

•  ab •  Apache Jmeter

•  Security Tests •  Chorizo •  Selenium and Chorizo

Page 91: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 91

PHPUnit

•  PHPUnit is a member of the xUnit family of testing frameworks (SUnit, jUnit, pyUnit...).

Page 92: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 92

PHPUnit

•  PHPUnit is a member of the xUnit family of testing frameworks (SUnit, jUnit, pyUnit...).

•  Written for PHP 5.

Page 93: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 93

PHPUnit

•  The xUnit frameworks provide a way to automate unit tests.

Page 94: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 94

PHPUnit

•  Make it easy to test, and you'll do it more often.

Page 95: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 95

PHPUnit

•  Make it easy to test, and you'll do it more often.

•  If you use version control, test before every check-in.

Page 96: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 96

PHPUnit

•  The PHPUnit Pocket Guide

Page 97: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 97

PHPUnit

•  The PHPUnit Pocket Guide

•  Tells you everything you need to know when writing PHPUnit test cases.

Page 98: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 98

PHPUnit

•  The PHPUnit Pocket Guide

•  Tells you everything you need to know when writing PHPUnit test cases.

•  Buy the book, or read the HTML version at: •  http://www.phpunit.de/pocket_guide/index.en.php

Page 99: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 99

PHPUnit

Let's look at a test case!

Page 100: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 100

PHPUnit <?php require_once 'PHPUnit/Framework.php';

class ArrayTest extends PHPUnit_Framework_TestCase { protected $fixture;

protected function setUp() { // Create the Array fixture. $this->fixture = array(); }

public function testNewArrayIsEmpty() { // Assert that the size of the Array fixture is 0. $this->assertEquals(0, sizeof($this->fixture)); }

public function testArrayContainsAnElement() { // Add an element to the Array fixture. $this->fixture[] = 'Element';

// Assert that the size of the Array fixture is 1. $this->assertEquals(1, sizeof($this->fixture)); } } ?>

Page 101: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 101

PHPUnit

•  Run a PHPUnit test case with the phpunit command.

Page 102: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 102

PHPUnit

•  Run a PHPUnit test case with the phpunit command.

phpunit UnitTest UnitTest.php

Page 103: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 103

PHPUnit

•  Run a PHPUnit test case with the phpunit command.

phpunit UnitTest UnitTest.php

•  Tells PHPUnit to look for a class UnitTest in the UnitTest.php file (filename is optional).

Page 104: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 104

PHPUnit

•  PHPUnit can output test logs to a variety of formats.

Page 105: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 105

PHPUnit

•  PHPUnit can output test logs to a variety of formats.

•  This allows results to be used for Continuous Integration.

Page 106: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 106

Continuous Integration

•  Continuous integration is a way to automatically run your test suite regularly.

Page 107: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 107

Continuous Integration

•  Continuous integration is a way to automatically run your test suite regularly.

•  Once a day …

Page 108: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 108

Continuous Integration

•  Continuous integration is a way to automatically run your test suite regularly.

•  Once a day …

•  Once an hour …

Page 109: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 109

Continuous Integration

•  Continuous integration is a way to automatically run your test suite regularly.

•  Once a day …

•  Once an hour …

•  Every time someone checks in code …

Page 110: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 110

What is integration?

•  Integrating a change (code, database structure …) into the source code repository without breaking the project.

Page 111: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 111

When is integration becoming important?

•  For any change that might break functionality.

Page 112: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 112

When is integration becoming important?

•  For any change that might break functionality.

•  More than one developer and/or multiple components.

Page 113: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 113

When is integration becoming important?

•  For any change that might break functionality.

•  More than one developer and/or multiple components.

•  More developers, more components = more complexity.

Page 114: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 114

Continuous Integration

•  It is a software engineering practice.

Page 115: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 115

Continuous Integration

•  It is a software engineering practice.

•  It describes how to integrate changes frequently.

Page 116: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 116

Continuous Integration

•  It is a software engineering practice.

•  It describes how to integrate changes frequently.

•  It stabilizes the product through self-testing code.

Page 117: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 117

Continuous Integration

•  It uses rapid feedback to solve integration issues fast and putting the pain upfront the development cycle. (Remember: software defects are more expensive the later they are fixed.)

Page 118: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 118

Continuous Integration

•  It uses rapid feedback to solve integration issues fast and putting the pain upfront the development cycle. (Remember: software defects are more expensive the later they are fixed.)

•  Goal: produce as many working builds as possible.

Page 119: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 119

Continuous Integration

•  Without unit tests Continuous Integration does not help a lot.

Page 120: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 120

Continuous Integration

•  Without unit tests Continuous Integration does not help a lot.

•  Start using PHPUnit or extend your test suite:

Page 121: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 121

Continuous Integration

•  Without unit tests Continuous Integration does not help a lot.

•  Start using PHPUnit or extend your test suite: •  Each identified bug deserves a unit test to prevent

regression.

Page 122: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 122

Continuous Integration

•  Without unit tests Continuous Integration does not help a lot.

•  Start using PHPUnit or extend your test suite: •  Each identified bug deserves a unit test to prevent

regression.

•  Develop unit tests for each new feature.

Page 123: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 123

Continuous Integration

•  Without unit tests Continuous Integration does not help a lot.

•  Start using PHPUnit or extend your test suite: •  Each identified bug deserves a unit test to prevent

regression.

•  Develop unit tests for each new feature.

•  You don’t need full code coverage. Find the right level!

Page 124: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 124

How to get started with Continuous Integration

•  Keep everything under version control.

Page 125: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 125

How to get started with Continuous Integration

•  Keep everything under version control. •  Automation does not work if pieces are missing.

Page 126: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 126

How to get started with Continuous Integration

•  Keep everything under version control. •  Automation does not work if pieces are missing.

•  Clone your production environment:

Page 127: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 127

How to get started with Continuous Integration

•  Keep everything under version control. •  Automation does not work if pieces are missing.

•  Clone your production environment: •  At least versions of main components should match.

Page 128: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 128

How to get started with Continuous Integration

•  Keep everything under version control. •  Automation does not work if pieces are missing.

•  Clone your production environment: •  At least versions of main components should match.

•  Automate the deployment of that environment.

Page 129: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 129

How to get started with Continuous Integration

•  Continuous Integration is more than setting up a CI server.

Page 130: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 130

How to get started with Continuous Integration

•  Continuous Integration is more than setting up a CI server.

•  You have to live Continuous Integration.

Page 131: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 131

How to get started with Continuous Integration

•  Continuous Integration is more than setting up a CI server.

•  You have to live Continuous Integration.

•  Keep in mind: CI is a customized , tailored process:

Page 132: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 132

How to get started with Continuous Integration

•  Continuous Integration is more than setting up a CI server.

•  You have to live Continuous Integration.

•  Keep in mind: CI is a customized , tailored process: •  CI in company A is not necessarily the same as in

company B.

Page 133: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 133

Benefits of Continuous Integration

•  Enforce your build policies.

Page 134: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 134

Benefits of Continuous Integration

•  Enforce your build policies.

•  Inform developers of build statuses.

Page 135: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 135

Benefits of Continuous Integration

•  Enforce your build policies.

•  Inform developers of build statuses.

•  Make builds and reports available to everyone.

Page 136: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 136

Benefits of Continuous Integration

•  Enforce your build policies.

•  Inform developers of build statuses.

•  Make builds and reports available to everyone.

•  Automate deployments to various testing environments.

Page 137: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 137

Your team and Continuous Integration

•  The team should always see the monitor.

Page 138: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 138

Your team and Continuous Integration

•  The team should always see the monitor.

•  Transparency is important – Developers need to see status and bugs.

Page 139: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 139

Your team and Continuous Integration

•  The team should always see the monitor.

•  Transparency is important – Developers need to see status and bugs.

•  Define some punishment for breaking the build.

Page 140: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 140

CruiseControl / phpUnderControl

•  The mother of all CI servers.

Page 141: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 141

CruiseControl / phpUnderControl

•  The mother of all CI servers.

•  phpUnderControl features:

Page 142: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 142

CruiseControl / phpUnderControl

•  The mother of all CI servers.

•  phpUnderControl features: •  Support for different code metric views.

Page 143: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 143

CruiseControl / phpUnderControl

•  The mother of all CI servers.

•  phpUnderControl features: •  Support for different code metric views.

•  It includes, but is not limited to, plugins for email notification, Ant, Phing, and various source control tools.

Page 144: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 144

CruiseControl / phpUnderControl

•  The mother of all CI servers.

•  phpUnderControl features: •  Support for different code metric views.

•  It includes, but is not limited to, plugins for email notification, Ant, Phing, and various source control tools.

•  A web interface is provided to view the details of the current and previous builds.

Page 145: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 145

CruiseControl / phpUnderControl

•  phpUnderControl is customization of CruiseControl that caters to the needs of PHP projects:

Page 146: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 146

CruiseControl / phpUnderControl

•  phpUnderControl is customization of CruiseControl that caters to the needs of PHP projects: •  PHPUnit

Page 147: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 147

CruiseControl / phpUnderControl

•  phpUnderControl is customization of CruiseControl that caters to the needs of PHP projects: •  PHPUnit

•  PHPDocumentor

Page 148: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 148

CruiseControl / phpUnderControl

•  phpUnderControl is customization of CruiseControl that caters to the needs of PHP projects: •  PHPUnit

•  PHPDocumentor

•  PHP_CodeSniffer

Page 149: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 149

CruiseControl / phpUnderControl

•  phpUnderControl is customization of CruiseControl that caters to the needs of PHP projects: •  PHPUnit

•  PHPDocumentor

•  PHP_CodeSniffer

•  PHP_Depend

Page 150: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 150

CruiseControl / phpUnderControl

•  phpUnderControl is customization of CruiseControl that caters to the needs of PHP projects: •  PHPUnit

•  PHPDocumentor

•  PHP_CodeSniffer

•  PHP_Depend •  PHP_CompatInfo

Page 151: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 151

CruiseControl / phpUnderControl

•  phpUnderControl is customization of CruiseControl that caters to the needs of PHP projects: •  PHPUnit

•  PHPDocumentor

•  PHP_CodeSniffer

•  PHP_Depend •  PHP_CompatInfo

•  … your own tools

Page 152: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 152

Code metrics

•  A software metric is a measured value for a quality of software.

Page 153: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 153

Code metrics

•  A software metric is a measure of some property of a piece of software or is specifications.

•  You cannot control what you cannot measure.

Page 154: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 154

Measuring code quality

•  Lines of code.

Page 155: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 155

Measuring code quality

•  Lines of code.

•  Text-based metric for code size

Page 156: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 156

Measuring code quality

•  Lines of code.

•  Text-based metric for code size

•  Several definitions:

Page 157: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 157

Measuring code quality

•  Lines of code.

•  Text-based metric for code size

•  Several definitions: •  Lines of Code (LOC)

Page 158: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 158

Measuring code quality

•  Lines of code.

•  Text-based metric for code size

•  Several definitions: •  Lines of Code (LOC)

•  Comment Lines of Code (CLOC)

Page 159: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 159

Measuring code quality

•  Lines of code.

•  Text-based metric for code size

•  Several definitions: •  Lines of Code (LOC)

•  Comment Lines of Code (CLOC)

•  Non-Comment Lines of Code (NCLOC)

Page 160: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 160

Measuring code quality

•  Lines of code.

•  Text-based metric for code size

•  Several definitions: •  Lines of Code (LOC)

•  Comment Lines of Code (CLOC)

•  Non-Comment Lines of Code (NCLOC)

•  Executable Lines of Code (ELOC)

Page 161: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 161

Measuring code quality

•  Lines of code.

•  Ratios are of interest:

Page 162: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 162

Measuring code quality

•  Lines of code.

•  Ratios are of interest: •  I.e. ratio of CLOC / (E)LOC

Page 163: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 163

Measuring code quality

•  Code coverage

Page 164: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 164

Measuring code quality

•  Code coverage

•  Tells how many lines of code are covered by your unit tests.

Page 165: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 165

Measuring code quality

•  Code coverage

•  Tells how many lines of code are covered by your unit tests.

•  100% Code coverage is a required criteria, but it doesn’t tell if your tests do test your code sufficient enough.

Page 166: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 166

Measuring code quality

•  Code coverage

•  Which statements, branches, and paths are executed when the tests run?

Page 167: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 167

Measuring code quality

•  Code coverage

•  Which statements, branches, and paths are executed when the tests run? •  C0-Coverage: Statement Coverage

Page 168: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 168

Measuring code quality

•  Code coverage

•  Which statements, branches, and paths are executed when the tests run? •  C0-Coverage: Statement Coverage

•  C1-Coverage: Branch Coverage

Page 169: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 169

Measuring code quality

•  Code coverage

•  Which statements, branches, and paths are executed when the tests run? •  C0-Coverage: Statement Coverage

•  C1-Coverage: Branch Coverage

•  C2-Coverage: Path Coverage

Page 170: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 170

Measuring code quality

•  Cyclomatic Complexity

Page 171: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 171

Measuring code quality

•  Cyclomatic Complexity

•  Metric for the complexity of a code unit

Page 172: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 172

Measuring code quality

•  Cyclomatic Complexity

•  Metric for the complexity of a code unit

•  Counting the branching points:

Page 173: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 173

Measuring code quality

•  Cyclomatic Complexity

•  Metric for the complexity of a code unit

•  Counting the branching points: •  if, for, foreach, while, case, catch, &&, ||, ternary

operator (?:)

Page 174: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 174

Measuring code quality

•  Cyclomatic Complexity

•  Interpretation:

Page 175: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 175

Measuring code quality

•  Cyclomatic Complexity

•  Interpretation: •  Higher complexity leads to more errors

Page 176: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 176

Measuring code quality

•  Cyclomatic Complexity

•  Interpretation: •  Higher complexity leads to more errors

•  Higher complexity makes testing harder

Page 177: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 177

Analyze your code quality

•  Use the following tools:

Page 178: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 178

Analyze your code quality

•  Use the following tools: •  PHPUnit

Page 179: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 179

Analyze your code quality

•  Use the following tools: •  PHPUnit

•  PhpDocumentor •  Generate API documentation

Page 180: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 180

Analyze your code quality

•  Use the following tools: •  PHPUnit

•  PhpDocumentor •  Generate API documentation

•  PHP_CodeSniffer •  Coding Style •  Correctness of API Documentation

Page 181: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 181

Analyze your code quality

•  Use the following tools: •  PHPUnit

•  PhpDocumentor •  Generate API documentation

•  PHP_CodeSniffer •  Coding Style •  Correctness of API Documentation

•  Php_Depend •  Analyze code dependencies

Page 182: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 182

Analyze your code quality

•  Use the following tools: •  PHPUnit

•  PhpDocumentor •  Generate API documentation

•  PHP_CodeSniffer •  Coding Style •  Correctness of API Documentation

•  Php_Depend •  Analyze code dependencies

•  Zend Code Analyzer •  Unreachable Code •  Unused parameters and variables

Page 183: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 183

Collect code analysis

•  Either collect all analysis results in your CI server or build a tool to let your developers see a wrap-up of all analyzer results.

Page 184: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 184

Collect code analysis

•  Either collect all analysis results in your CI server or build a tool to let your developers see a wrap-up of all analyzer results.

•  Categorize code analysis results in different levels.

Page 185: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 185

Collect code analysis

•  Either collect all analysis results in your CI server or build a tool to let your developers see a wrap-up of all analyzer results.

•  Categorize code analysis results in different levels.

•  Higher rated issues need to be fixed first.

Page 186: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 186

Continual metrics

•  Metric values are not definite values.

Page 187: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 187

Continual metrics

•  Metric values are not definite values.

•  Wire metrics and analysis into continuous integration.

Page 188: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 188

Continual metrics

•  Metric values are not definite values.

•  Wire metrics and analysis into continuous integration.

•  Discuss on iteration boundaries.

Page 189: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 189

Continual metrics

•  Metric values are not definite values.

•  Wire metrics and analysis into continuous integration.

•  Discuss on iteration boundaries.

•  It is important to note that variations of metrics need more attention than its values.

Page 190: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 190

Issue tracking

•  Issues and tasks need to be:

Page 191: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 191

Issue tracking

•  Issues and tasks need to be: •  organized

Page 192: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 192

Issue tracking

•  Issues and tasks need to be: •  organized

•  allocated

Page 193: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 193

Issue tracking

•  Issues and tasks need to be: •  organized

•  allocated

•  scheduled

Page 194: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 194

Issue tracking

•  Issues and tasks need to be: •  organized

•  allocated

•  scheduled

•  tracked

Page 195: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 195

Issue tracking

•  Issues and tasks need to be: •  organized

•  allocated

•  scheduled

•  tracked

•  That’s where an issue tracker comes into play.

Page 196: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 196

Issue tracking

•  An Issue tracker is a software application that is designed to help quality assurance and programmers keep track of reported software bugs in their work.

Page 197: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 197

Issue tracking

•  An Issue tracker is a software application that is designed to help quality assurance and programmers keep track of reported software bugs in their work.

•  Issues may include the time a bug was reported, its severity, the erroneous program behavior, and details on how to reproduce the bug; as well as any programmers who may be working on fixing it.

Page 198: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 198

Issue tracking

•  Typical issue tracking systems support the concept of the life cycle for a bug/feature which is tracked through the status assigned to the issue.

Page 199: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 199

Issue tracking

•  Typical issue tracking systems support the concept of the life cycle for a bug/feature which is tracked through the status assigned to the issue.

•  You can also assign the expected time needed to fix a bug so you can plan how many issues may be solved in one iteration.

Page 200: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 200

Issue tracking

•  If supported by your issue tracker and version control system use a hook script to let developers mark commits to an active issue.

Page 201: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 201

Issue tracking

•  If supported by your issue tracker and version control system use a hook script to let developers mark commits to an active issue.

•  If you require an issue ID in the commit message developers are forced to use the issue tracking software.

Page 202: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 202

Pair Programming

•  Helps write better code by dividing responsibility between two people.

Page 203: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 203

Pair Programming

•  Helps write better code by dividing responsibility between two people.

•  Observer – strategy

Page 204: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 204

Pair Programming

•  Helps write better code by dividing responsibility between two people.

•  Observer – strategy •  Improvements

Page 205: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 205

Pair Programming

•  Helps write better code by dividing responsibility between two people.

•  Observer – strategy •  Improvements

•  Future problems

Page 206: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 206

Pair Programming

•  Helps write better code by dividing responsibility between two people.

•  Observer – strategy •  Improvements

•  Future problems

•  Driver – tactics

Page 207: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 207

Pair Programming

•  Helps write better code by dividing responsibility between two people.

•  Observer – strategy •  Improvements

•  Future problems

•  Driver – tactics •  Completing the task

Page 208: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 208

Pair Programming

•  Observer functions as safety net and guide.

Page 209: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 209

Pair Programming

•  Observer functions as safety net and guide.

•  Observer and Driver can exchange roles.

Page 210: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 210

Pair Programming

•  Benefits

Page 211: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 211

Pair Programming

•  Benefits •  Design quality

Page 212: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 212

Pair Programming

•  Benefits •  Design quality

•  Reduced cost due to fewer defects

Page 213: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 213

Pair Programming

•  Benefits •  Design quality

•  Reduced cost due to fewer defects

•  Learning & Training

Page 214: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 214

Pair Programming

•  Benefits •  Design quality

•  Reduced cost due to fewer defects

•  Learning & Training

•  Shared knowledge of product

Page 215: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 215

Pair Programming

•  Benefits •  Design quality

•  Reduced cost due to fewer defects

•  Learning & Training

•  Shared knowledge of product

•  Improved discipline and time management

Page 216: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 216

Pair Review/Buddy System

•  Review your code/tests regularly with different partners in short meetings.

Page 217: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 217

Pair Review/Buddy System

•  Review your code/tests regularly with different partners in short meetings.

•  Solve difficult problems.

Page 218: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 218

Pair Review/Buddy System

•  Review your code/tests regularly with different partners in short meetings.

•  Solve difficult problems.

•  Exchange best practices, ideas, elegant solutions.

Page 219: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 219

Pair Review/Buddy System

•  Review your code/tests regularly with different partners in short meetings.

•  Solve difficult problems.

•  Exchange best practices, ideas, elegant solutions.

•  Just spread knowledge.

Page 220: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 220

Code Reviews: Too time consuming?

•  Code Reviews may seem to be to be too time consuming when time pressure increases.

Page 221: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 221

Code Reviews: Too time consuming?

•  Code Reviews may seem to be to be too time consuming when time pressure increases.

•  Without specific approaches to manage the reviews they might be in fact too time consuming.

Page 222: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 222

Code Reviews: Too time consuming?

•  Code Reviews may seem to be to be too time consuming when time pressure increases.

•  Without specific approaches to manage the reviews they might be in fact too time consuming.

•  These issues are simply problems with some review processes.

Page 223: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 223

Code Reviews: Your return on investment

•  Regular peer review is a proven process with demonstrable ROI.

Page 224: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 224

Code Reviews: Your return on investment

•  Regular peer review is a proven process with demonstrable ROI.

•  The benefits vary from team to team but commonly include:

Page 225: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 225

Code Reviews: Your return on investment

•  Regular peer review is a proven process with demonstrable ROI.

•  The benefits vary from team to team but commonly include: •  Identifying bugs and defects early.

Page 226: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 226

Code Reviews: Your return on investment

•  Regular peer review is a proven process with demonstrable ROI.

•  The benefits vary from team to team but commonly include: •  Identifying bugs and defects early.

•  Sharing expertise and encouraging knowledge transfer.

Page 227: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 227

Code Reviews: Your return on investment

•  Regular peer review is a proven process with demonstrable ROI.

•  The benefits vary from team to team but commonly include: •  Identifying bugs and defects early.

•  Sharing expertise and encouraging knowledge transfer.

•  Encouraging adherence to internal standards and style conventions.

Page 228: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 228

Code Reviews: Your return on investment

•  Regular peer review is a proven process with demonstrable ROI.

•  The benefits vary from team to team but commonly include: •  Identifying bugs and defects early.

•  Sharing expertise and encouraging knowledge transfer.

•  Encouraging adherence to internal standards and style conventions.

•  Identifying individual strengths and weaknesses.

Page 229: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 229

Code Reviews: Processes are your friend!

•  Defining Code Review Iterations is as important as defining how to do them!

Page 230: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 230

Code Reviews: Processes are your friend!

•  Defining Code Review Iterations is as important as defining how to do them!

•  Don‘t skip any Code Reviews as changes to your source code are more expensive the later you do them!

Page 231: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 231

Code Reviews: What are the best tools?

•  A human being!

Page 232: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 232

Code Reviews: What are the best tools?

•  A human being!

•  There is pair programming – why not make it pair reviewing?

Page 233: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 233

Code Reviews: What are the best tools?

•  A human being!

•  There is pair programming – why not make it pair reviewing?

•  An initial Code Review is faster and more reliable to be done, if both Reviewer and Developer can communicate directly with each other.

Page 234: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 234

Code Reviews: Web-based tool: Crucible

•  Crucible is a web based Code Review tool by Atlassian Software Systems Pty Ltd.

Page 235: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 235

Code Reviews: Web-based tool: Crucible

•  Crucible is a web based Code Review tool by Atlassian Software Systems Pty Ltd.

•  Commercial tool – but available free of charge for Open Source projects.

Page 236: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 236

Code Reviews: Web-based tool: Crucible

•  Crucible is a web based Code Review tool by Atlassian Software Systems Pty Ltd.

•  Commercial tool – but available free of charge for Open Source projects.

•  Crucible's mission is to streamline the process aspects so development teams can access the benefits.

Page 237: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 237

Code Reviews: Web-based tool: Crucible

•  This is how it looks like:

Page 238: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 238

Code Reviews: Web-based tool: Crucible

•  You create a new review from your version control system:

Page 239: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 239

Code Reviews: Web-based tool: Crucible

•  Your review is open:

Page 240: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 240

Code Reviews: Web-based tool: Crucible

•  Both reviewer and developer can communicate about the code:

Page 241: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 241

Code Reviews: Web-based tool: Crucible

•  Both reviewer and developer can communicate about the code:

Page 242: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 242

Code Reviews: Web-based tool: Crucible

•  Commits can either be done after committing to a version control system or using pre-commit diff files.

Page 243: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 243

Testing your web application

•  Now that we covered the code analysis what about the product you are creating?

Page 244: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 244

Testing your web application

•  Now that we covered the code analysis what about the product you are creating?

•  We want to have automated tests for our web application that do regression testing, compare results and check whether our application runs flawlessly in all of our supported browsers.

Page 245: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 245

Testing your web application

•  Challenges:

Page 246: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 246

Testing your web application

•  Challenges: •  Modern GUI app testing (AJAX & Co.)

Page 247: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 247

Testing your web application

•  Challenges: •  Modern GUI app testing (AJAX & Co.)

•  OS / browser / platform

Page 248: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 248

Testing your web application

•  Challenges: •  Modern GUI app testing (AJAX & Co.)

•  OS / browser / platform

•  JavaScript engines / versions / levels

Page 249: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 249

Testing your web application

•  There is the Selenium product family:

Page 250: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 250

Testing your web application

•  There is the Selenium product family:

•  Selenium Core

Page 251: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 251

Testing your web application

•  There is the Selenium product family:

•  Selenium Core

•  Selenium IDE

Page 252: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 252

Testing your web application

•  There is the Selenium product family:

•  Selenium Core

•  Selenium IDE

•  Selenium RC

Page 253: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 253

Testing your web application

•  Selenium Core:

Page 254: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 254

Testing your web application

•  Selenium Core: •  JavaScript engine

Page 255: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 255

Testing your web application

•  Selenium Core: •  JavaScript engine

•  runs in browser

Page 256: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 256

Testing your web application

•  Selenium Core: •  JavaScript engine

•  runs in browser

•  controls web application in other frame

Page 257: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 257

Testing your web application

•  Selenium Core: •  JavaScript engine

•  runs in browser

•  controls web application in other frame

•  exposes its API

Page 258: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 258

Testing your web application

•  Selenium IDE:

Page 259: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 259

Testing your web application

•  Selenium IDE: •  Firefox plugin

Page 260: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 260

Testing your web application

•  Selenium IDE: •  Firefox plugin

•  directly communicates with Selenium Core in the browser

Page 261: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 261

Testing your web application

•  Selenium IDE: •  Firefox plugin

•  directly communicates with Selenium Core in the browser

•  Records / replays scenarios

Page 262: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 262

Testing your web application

•  Selenium IDE: •  Firefox plugin

•  directly communicates with Selenium Core in the browser

•  Records / replays scenarios

•  great to get started (interactively)

Page 263: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 263

Testing your web application

•  Selenium RC:

Page 264: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 264

Testing your web application

•  Selenium RC: •  remote control

Page 265: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 265

Testing your web application

•  Selenium RC: •  remote control

•  server component and proxy

Page 266: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 266

Testing your web application

•  Selenium RC: •  remote control

•  server component and proxy

•  allows test automation in various ways

Page 267: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 267

Testing your web application

•  Selenium RC: •  remote control

•  server component and proxy

•  allows test automation in various ways

•  has a capability called Selenium Grid, to drive multiple instances of the Selenium RC server

Page 268: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 268

Advantages of Selenium

•  Tests run directly in browser

Page 269: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 269

Advantages of Selenium

•  Tests run directly in browser

•  Implemented entirely using browser  technologies:

Page 270: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 270

Advantages of Selenium

•  Tests run directly in browser

•  Implemented entirely using browser  technologies: •  JavaScript

Page 271: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 271

Advantages of Selenium

•  Tests run directly in browser

•  Implemented entirely using browser  technologies: •  JavaScript

•  DHTML

Page 272: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 272

Advantages of Selenium

•  Tests run directly in browser

•  Implemented entirely using browser  technologies: •  JavaScript

•  DHTML

•  Frames

Page 273: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 273

Advantages of Selenium

•  Selenium interacts with the DOM served to  the browser

Page 274: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 274

Advantages of Selenium

•  Selenium interacts with the DOM served to  the browser

•  Selenium is agnostic of server side  technology

Page 275: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 275

Concepts of Selenium

•  Element Locators:

Page 276: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 276

Concepts of Selenium

•  Element Locators: •  specify HTML elements

Page 277: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 277

Concepts of Selenium

•  Element Locators: •  specify HTML elements

•  Patterns:

Page 278: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 278

Concepts of Selenium

•  Element Locators: •  specify HTML elements

•  Patterns: •  for pattern matching values

Page 279: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 279

Concepts of Selenium

•  Element Locators: •  specify HTML elements

•  Patterns: •  for pattern matching values

•  Actions:

Page 280: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 280

Concepts of Selenium

•  Element Locators: •  specify HTML elements

•  Patterns: •  for pattern matching values

•  Actions: •  manipulate application state

Page 281: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 281

Concepts of Selenium

•  Accessors:

Page 282: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 282

Concepts of Selenium

•  Accessors: •  store results in variables

Page 283: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 283

Concepts of Selenium

•  Accessors: •  store results in variables

•  Assertions:

Page 284: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 284

Concepts of Selenium

•  Accessors: •  store results in variables

•  Assertions: •  verify that the application is in a certain  state

Page 285: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 285

Useful Selenium Tools

•  For Firefox!

Page 286: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 286

Useful Selenium Tools

•  For Firefox! •  Web Developer Toolbar

Page 287: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 287

Useful Selenium Tools

•  For Firefox! •  Web Developer Toolbar

•  Firebug

Page 288: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 288

Useful Selenium Tools

•  For Firefox! •  Web Developer Toolbar

•  Firebug

•  XPather

Page 289: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 289

Useful Selenium Tools

•  For Firefox! •  Web Developer Toolbar

•  Firebug

•  XPather

•  Xpath Checker

Page 290: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 290

Maintaining Selenium Tests

•  Test code is just like production code.

Page 291: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 291

Maintaining Selenium Tests

•  Test code is just like production code.

•  Needs re­factoring, abstraction.

Page 292: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 292

Maintaining Selenium Tests

•  Test code is just like production code.

•  Needs re­factoring, abstraction.

•  Try to maintain meaning – in test names, variable names, comments, and test suite organization.

Page 293: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 293

Test Fragility

•  Tests are fragile.

Page 294: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 294

Test Fragility

•  Tests are fragile.

•  They break when your code changes.

Page 295: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 295

Test Fragility

•  Tests are fragile.

•  They break when your code changes.

•  Stabilize them!

Page 296: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 296

Test Fragility

•  Minimize influences:

Page 297: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 297

Test Fragility

•  Minimize influences: •  Use Mock Objects

Page 298: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 298

Test Fragility

•  Minimize influences: •  Use Mock Objects

•  Recreate dependencies – SetUp

Page 299: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 299

Test Fragility

•  Minimize influences: •  Use Mock Objects

•  Recreate dependencies – SetUp

•  Clean up your test environment – TearDown

Page 300: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 300

Test Fragility

•  Minimize influences: •  Use Mock Objects

•  Recreate dependencies – SetUp

•  Clean up your test environment – TearDown

•  Use non-fragile locators

Page 301: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 301

Mock Objects

•  Let Unit Tests test the code not the dependencies:

Page 302: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 302

Mock Objects

•  Let Unit Tests test the code not the dependencies: •  Simulate complex objects

Page 303: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 303

Mock Objects

•  Let Unit Tests test the code not the dependencies: •  Simulate complex objects

•  Simulate database connections

Page 304: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 304

Mock Objects

•  Let Unit Tests test the code not the dependencies: •  Simulate complex objects

•  Simulate database connections

•  Simulate uncontrollable variables – time, temperature etc.

Page 305: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 305

Mock Objects

•  Let Unit Tests test the code not the dependencies: •  Simulate complex objects

•  Simulate database connections

•  Simulate uncontrollable variables – time, temperature etc.

•  Simulate objects that do not exist yet

Page 306: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 306

Test SetUp

•  Use the SetUp method to recreate testable states for functional tests:

Page 307: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 307

Test SetUp

•  Use the SetUp method to recreate testable states for functional tests: •  Use methods that are unit-tested

Page 308: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 308

Test SetUp

•  Use the SetUp method to recreate testable states for functional tests: •  Use methods that are unit-tested

•  Fill database with necessary data

Page 309: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 309

Test SetUp

•  Use the SetUp method to recreate testable states for functional tests: •  Use methods that are unit-tested

•  Fill database with necessary data

•  Tests can be run on additional fresh test environments.

Page 310: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 310

Test TearDown

•  Use the TearDown method to clean up your test environment:

Page 311: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 311

Test TearDown

•  Use the TearDown method to clean up your test environment: •  Remove no longer necessary database entries

Page 312: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 312

Test TearDown

•  Use the TearDown method to clean up your test environment: •  Remove no longer necessary database entries

•  Clean caches, no longer needed log files

Page 313: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 313

Test TearDown

•  Use the TearDown method to clean up your test environment: •  Remove no longer necessary database entries

•  Clean caches, no longer needed log files

•  Reduces uncontrollable influences on tests.

Page 314: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 314

Test TearDown

•  Use the TearDown method to clean up your test environment: •  Remove no longer necessary database entries

•  Clean caches, no longer needed log files

•  Reduces uncontrollable influences on tests.

•  Keeps test execution quick.

Page 315: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 315

Non-Fragile Locators

•  When using Selenium, use non-fragile locators:

Page 316: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 316

Non-Fragile Locators

•  When using Selenium, use non-fragile locators: •  Keep locators independent from DOM

Page 317: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 317

Non-Fragile Locators

•  When using Selenium, use non-fragile locators: •  Keep locators independent from DOM

•  Use ids or names

Page 318: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 318

Non-Fragile Locators

•  When using Selenium, use non-fragile locators: •  Keep locators independent from DOM

•  Use ids or names

•  Use wildcards where applicable

Page 319: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 319

Non-Fragile Locators

•  When using Selenium, use non-fragile locators: •  Keep locators independent from DOM

•  Use ids or names

•  Use wildcards where applicable

•  Dom-Locators (JavaScript expressions)

Page 320: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 320

Non-Fragile Locators

•  When using Selenium, use non-fragile locators: •  Keep locators independent from DOM

•  Use ids or names

•  Use wildcards where applicable

•  Dom-Locators (JavaScript expressions)

•  Page elements can be moved around, but your tests will still work.

Page 321: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 321

Release process

•  Make sure you have a standard procedure for releasing / launching new versions of your product.

Page 322: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 322

Release process

•  Make sure you have a standard procedure for releasing / launching new versions of your product.

•  Assign responsibility or have a dedicated release management.

Page 323: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 323

Release process

•  Make sure you have a standard procedure for releasing / launching new versions of your product.

•  Assign responsibility or have a dedicated release management.

•  Use the tools to the fullest.

Page 324: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 324

Release process: Versioning

•  Use the versioning system – choose a stable revision and branch.

Page 325: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 325

Release process: Versioning

•  Use the versioning system – choose a stable revision and branch.

•  Development can continue without breaking the stable branch.

Page 326: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 326

Release process: Versioning

•  If you find defects before next major version you can release stable versions by fixing them in the stable branch.

Page 327: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 327

Release process: Versioning

•  If you find defects before next major version you can release stable versions by fixing them in the stable branch.

•  Reintegrate fixes for bugs into the trunk so they are do not resurface.

Page 328: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 328

Release process: Delta Builder

•  Tool to collect data about stable branch.

Page 329: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 329

Release process: Delta Builder

•  Tool to collect data about stable branch.

•  List changes to the codebase since last release.

Page 330: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 330

Release process: Delta Builder

•  Tool to collect data about stable branch.

•  List changes to the codebase since last release.

•  Have developers review their changes.

Page 331: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 331

Release process: Delta Builder

•  Highlight important pieces of your product – configuration files, most used libraries etc.

Page 332: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 332

Release process: Delta Builder

•  Highlight important pieces of your product – configuration files, most used libraries etc.

•  Match versioning data with issue tracker – have all completed tasks been really checked into the versioning system?

Page 333: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 333

Release process: Tests

•  Dedicate time to test the stable branch before release.

Page 334: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 334

Release process: Tests

•  Dedicate time to test the stable branch before release.

•  Run all your tests as first step – last remaining defects found can be fixed before release.

Page 335: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 335

Release process: Tests

•  Make sure all your tests pass.

Page 336: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 336

Release process: Tests

•  Make sure all your tests pass.

•  A manual test can help you assure stability – find defects not identifiable by tests.

Page 337: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 337

Release process: Checklists

•  Minimize human error

Page 338: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 338

Release process: Checklists

•  Minimize human error

•  Collect all tasks for the release

Page 339: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 339

Release process: Checklists

•  Minimize human error

•  Collect all tasks for the release •  Running tests

Page 340: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 340

Release process: Checklists

•  Minimize human error

•  Collect all tasks for the release •  Running tests

•  Building dependencies

Page 341: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 341

Release process: Checklists

•  Minimize human error

•  Collect all tasks for the release •  Running tests

•  Building dependencies

•  Deploying all components of your product

Page 342: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 342

Release process: Checklists

•  Minimize human error

•  Collect all tasks for the release •  Running tests

•  Building dependencies

•  Deploying all components of your product

•  Communicating – notify all those that need to know!

Page 343: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 343

Checklists in general

•  Once again - Minimize human error!

Page 344: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 344

Checklists in general

•  Once again - Minimize human error!

•  All repetitive but complicated tasks:

Page 345: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 345

Checklists in general

•  Once again - Minimize human error!

•  All repetitive but complicated tasks: •  Creating the skeleton of a new module

Page 346: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 346

Checklists in general

•  Once again - Minimize human error!

•  All repetitive but complicated tasks: •  Creating the skeleton of a new module

•  Manually check the functionality of a module

Page 347: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 347

Checklists in general

•  Once again - Minimize human error!

•  All repetitive but complicated tasks: •  Creating the skeleton of a new module

•  Manually check the functionality of a module

•  Set up a new system ready to be shipped

Page 348: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 348

Checklists in general

•  Once again - Minimize human error!

•  All repetitive but complicated tasks: •  Creating the skeleton of a new module

•  Manually check the functionality of a module

•  Set up a new system ready to be shipped

•  …

Page 349: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 349

Questions?

Page 350: Ipc2008 Slide Qa In Depth Best Practises

Max Horváth & Wojciech Duda, studiVZ Ltd. 350

Thank You!