Testing on the Edge Sebastian Bergmann October 28th 2013



Similar documents
PHPUnit and Drupal 8 No Unit Left Behind. Paul Mitchum

Managing and Maintaining Windows Server 2008 Servers

Copyright Soleran, Inc. esalestrack On-Demand CRM. Trademarks and all rights reserved. esalestrack is a Soleran product Privacy Statement

VNLINFOTECH JOIN US & MAKE YOUR FUTURE BRIGHT. mcsa (70-413) Microsoft certified system administrator. (designing & implementing server infrasturcure)

R3: Windows Server 2008 Administration. Course Overview. Course Outline. Course Length: 4 Day

BASICS OF SCALING: LOAD BALANCERS

Setup Guide Central Monitoring of SAP NetWeaver Proces Integration 7.3 with SAP Solution Manager 7.1. Active Global Support February 2011

Creating the Conceptual Design by Gathering and Analyzing Business and Technical Requirements

PHPUnit Manual. Sebastian Bergmann

Automating Testing and Configuration Data Migration in OTM/GTM Projects using Open Source Tools By Rakesh Raveendran Oracle Consulting

Designing and Implementing a Server Infrastructure

Designing and Implementing a Server Infrastructure

20413C: Designing and Implementing a Server Infrastructure

Vincent Gabriel. Summary. Experience. Senior Software Developer at Landmark Network

COURSE 20413C: DESIGNING AND IMPLEMENTING A SERVER INFRASTRUCTURE

Microsoft Lync Server 2010

Designing and Implementing a Server Infrastructure

DRUPAL CONTINUOUS INTEGRATION. Part I - Introduction

Designing and Implementing a Server Infrastructure 20413C; 5 days, Instructor-led

Course 20413: Designing and Implementing a Server Infrastructure

Multi-Tenancy in SharePoint DD105 Spencer Harbar Enterprise Architect harbar.net

Designing and Implementing a Server Infrastructure

Desingning and Implementing a Server Infrastructure

Preliminary Course Syllabus

Launch with Confidence! Behavior Driven Development (BDD) 101. Presented by: Shawn Smiley [Director of Engineering Operations]

Designing a Windows Server 2008 Active Directory Infrastructure and Services

Designing and Implementing a Server Infrastructure

DEPLOYMENT GUIDE Version 1.1. Deploying the BIG-IP LTM v10 with Citrix Presentation Server 4.5

6436: Designing a Windows Server 2008 Active Directory Infrastructure and Services (5 Days)

Solutions Guide. Deploying Citrix NetScaler with Microsoft Exchange 2013 for GSLB. citrix.com

Agenda. How to configure

How to Make the Client IP Address Available to the Back-end Server

COURSE OUTLINE MOC 20413: DESIGNING AND IMPLEMENTING A SERVER INFRASTRUCTURE

PHPUnit Manual. Sebastian Bergmann

symfony symfony as a platform Fabien Potencier

Deploying the BIG-IP LTM with. Citrix XenApp. Deployment Guide Version 1.2. What s inside: 2 Prerequisites and configuration notes

Installation Guide Avi Networks Cloud Application Delivery Platform Integration with Cisco Application Policy Infrastructure

Designing and Implementing a Server Infrastructure

Automated Web Applications Testing

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence


Guide to Deploying Microsoft Exchange 2013 with Citrix NetScaler

MCSA: Windows Server 2008

HARDWARE, SOFTWARE AND CONFIGURATION REQUIREMENTS

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

HAProxy. Ryan O'Hara Principal Software Engineer, Red Hat September 17, HAProxy

Citrix NetScaler 10 Essentials and Networking

Application Note. Active Directory Federation Services deployment guide

NIIT Education and Training, Doha, Qatar - Contact: /1798;

CA Identity Manager. Glossary. r12.5 SP8

Build Your Knowledge!

Juniper Networks Secure Access. Initial Configuration User Records Synchronization

CNS-208 CITRIX NETSCALER 10.5 ESSENTIALS FOR ACE MIGRATION

ZEN LOAD BALANCER EE v3.02 DATASHEET The Load Balancing made easy

Test Automation -Selenium

CloudCERT (Testbed framework to exercise critical infrastructure protection)

CNS-205 Citrix NetScaler 10 Essentials and Networking

GlassFish Security. open source community experience distilled. security measures. Secure your GlassFish installation, Web applications,

S y s t e m A r c h i t e c t u r e

MS 6419 Configuring, Managing and Maintaining Windows Server 2008-based Servers

Course Description. Course Page - Page 1 of 9. Administering Windows Server 2012 M Length: 5 days Price: $2,795.00

Load Balancer Configuration for Redundancy for SIP Federation

PES. High Availability Load Balancing in the Agile Infrastructure. Platform & Engineering Services. HEPiX Bologna, April 2013

Practical Guided Tour of Symfony

MarkLogic Server. Reference Application Architecture Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

How To Manage A Netscaler On A Pc Or Mac Or Mac With A Net Scaler On An Ipad Or Ipad With A Goslade On A Ggoslode On A Laptop Or Ipa On A Network With

KEMP LoadMaster. Enabling Hybrid Cloud Solutions in Microsoft Azure

This presentation describes the IBM Tivoli Monitoring 6.1 Firewall Implementation: KDE Gateway Component.

Designing a Windows Server 2008 Active Directory Infrastructure and Services

CNS-208 Citrix NetScaler 10.5 Essentials for ACE Migration

VMware vcloud Air. Enterprise IT Hybrid Data Center TECHNICAL MARKETING DOCUMENTATION

Creating a New Domain Tree in the Forest

Vocia MS-1 Network Considerations for VoIP. Vocia MS-1 and Network Port Configuration. VoIP Network Switch. Control Network Switch

NIIT Education and Training, Doha, Qatar - Contact: /1798;

Continuous Prevention Testing

Many network and firewall administrators consider the network firewall at the network edge as their primary defense against all network woes.

Introduction to SAML

Implementing and Managing Microsoft Exchange Server 2003

Transcription:

Testing on the Edge Sebastian Bergmann October 28th 2013

Sebastian Bergmann» Has instrumentally contributed to transforming PHP into a reliable platform for large-scale, critical projects.» Enterprises and PHP developers around the world benefit from the tools that he has developed and the experience he shares. sharing experience

sharing experience

Presentation Model Presentation View Template HTTP Abstraction Application Logic Routing Controller Domain Logic Persistence

Responsible for representing concepts of the business, information about the business situation, and business rules. State that reflects the business situation is controlled and used here, even though the technical details of storing it are delegated to the infrastructure. This layer is the heart of business software. Eric Evans Domain Logic

Unit

Unit Stub / Mock

Unit Unit

Disintegration Testing The peer review preliminary findings indicate that one team used English units (e.g., inches, feet and pounds) while the other used metric units for a key spacecraft operation. http://mars.jpl.nasa.gov/msp98/news/mco990930.html

Client Server

Selenium

Behat + Mink

PHPUnit + Mink

<?php use Behat\Mink\Session; use Behat\Mink\Driver\GoutteDriver; abstract class MinkTestCase extends PHPUnit_Framework_TestCase private $session; protected function setup() $this->session = new Session(new GoutteDriver); protected function visit($url) $this->session->visit($url); return $this->session->getpage(); sharing experience

<?php class ApplicationTest extends MinkTestCase public function testexamplepagecontainsexampletext() $page = $this->visit('http://example.com/'); $this->assertcontains( 'Example Domain', $page->getcontent() ); sharing experience

Client Server

<?php namespace Company\Project; class Application public function run(requestinterface $request, ResponseInterface $response) //... sharing experience

<?php namespace Company\Project; interface ResponseInterface public function setdata($key, $value); public function getdata($key); public function hasdata($key); //... sharing experience

<?php namespace Company\Project\Tests; use Company\Project\Application; use Company\Project\Request; use Company\Project\Response; class HomepageTest extends PHPUnit_Framework_TestCase protected function setup() $this->application = new Application; $this->request = new Request; $this->response = new Response; public function testhasnavigation() $this->application->run($this->request, $this->response); $this->asserttrue($this->response->hasdata('navigation')); sharing experience

<?php namespace Company\Project\Tests; use Company\Project\Application; use Company\Project\Request; use Company\Project\Response; class HomepageTest extends PHPUnit_Framework_TestCase protected function setup() $this->application = new Application; $this->request = new Request; $this->response = new Response; public function testhasnavigation() $this->application->run($this->request, $this->response); $this->asserttrue($this->response->hasdata('navigation')); sharing experience

<?php namespace Company\Project\Tests; use Company\Project\Application; use Company\Project\Request; use Company\Project\Response; class HomepageTest extends IntegrationTestCase protected function setup() $this->application = new Application; $this->request = new Request; $this->response = new Response; public function testhasnavigation() $this->application->run($this->request, $this->response); $this->assertresponsehasdata('navigation', $this->response); sharing experience

Implementing Custom Assertions

<?php namespace Company\Project\Tests; use Company\Project\ResponseInterface; use PHPUnit_Framework_TestCase; abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase sharing experience

<?php namespace Company\Project\Tests; use Company\Project\ResponseInterface; use PHPUnit_Framework_TestCase; abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase public function assertresponsehasdata($name, ResponseInterface $response) sharing experience

<?php namespace Company\Project\Tests; use Company\Project\ResponseInterface; use PHPUnit_Framework_TestCase; abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase public function assertresponsehasdata($name, ResponseInterface $response) $constraint = new DataExistsConstraint($response); sharing experience

<?php namespace Company\Project\Tests; use Company\Project\ResponseInterface; use PHPUnit_Framework_Constraint; class DataExistsConstraint extends PHPUnit_Framework_Constraint private $response; public function construct(responseinterface $response) $this->response = $response; protected function matches($other) return $this->response->hasdata($other); public function tostring() return 'data exists'; sharing experience

<?php namespace Company\Project\Tests; use Company\Project\ResponseInterface; use PHPUnit_Framework_TestCase; abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase public function assertresponsehasdata($name, ResponseInterface $response) $constraint = new DataExistsConstraint($response); $this->assertthat($name, $constraint); sharing experience

<?php namespace Company\Project\Tests; use Company\Project\ResponseInterface; use PHPUnit_Framework_TestCase; abstract class IntegrationTestCase extends PHPUnit_Framework_TestCase public function assertresponsehasdata($name, ResponseInterface $response) $constraint = new DataExistsConstraint($response); $this->assertthat($name, $constraint); public function assertresponsenothasdata($name, ResponseInterface $response) $constraint = new DataExistsConstraint($response); $this->assertthat($name, $this->logicalnot($constraint)); sharing experience

Looking ahead: Test Proxies in PHPUnit 3.8

<?php namespace Company\Project; class SampleWorkflow private $backend; private $service; public function construct(backend $backend, Service $service) $this->backend = $backend; $this->service = $service; public function execute(request $request) $this->service->dowork( $this->backend->getobjectbyid($request->getvalue('id')) ); sharing experience

<?php namespace Company\Project; use PHPUnit_Framework_TestCase; class SampleWorkflowTest extends PHPUnit_Framework_TestCase public function testservicecallupdatesobject() $service = $this->getmockbuilder('service') ->enableproxyingtooriginalmethods() ->getmock(); $service->expects($this->once()) ->method('dowork'); $backend = new Backend; $workflow = new SampleWorkflow($backend, $service); $workflow->execute(new Request(array('id' => 2204))); sharing experience

talks.thephp.cc sebastian@thephp.cc @s_bergmann

Become a Certified PHP Craftsman in 2014! http://thephpcurriculum.com/