Learning Yii Testing
eBook - ePub

Learning Yii Testing

Matteo Pescarin

Buch teilen
  1. 222 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Learning Yii Testing

Matteo Pescarin

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Learning Yii Testing als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Learning Yii Testing von Matteo Pescarin im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Ciencia de la computación & Programación web. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Learning Yii Testing


Table of Contents

Learning Yii Testing
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. The Testing Mindset
Understanding the importance of testing
Involving project management
Estimating tasks
Testing approaches
Introducing Test Driven Development
Planning tests
Generating tests
Obtaining the testing mindset
Starting with no testing culture – a practical approach
Summary
2. Tooling up for Testing
Downloading and installing Yii 2
Environment and workflow
Introducing Composer
Installing and using it
The composer.json and composer.lock files
Packages and Packagist
Creating your first web app
The CLI command line
Finding your way around Yii 2
Structure of the default web application
Documentation and sample code
Defining our working strategy
Key features to be implemented
User authentication REST interface
User login from a modal window
Introducing testing for our purposes
Using a top-down approach versus a bottom-up approach
What to test and what not to test
The master test plan
Summary
3. Entering Codeception
Getting started with Codeception
A modular framework rather than just another tool
Outlining concepts behind Codeception
Types of tests
AcceptanceTester
FunctionalTester
UnitTester
Other features provided by Codeception
Installing Codeception in Yii 2
Finding your way around Codeception
Configuring Codeception
Tests available in Yii 2
Interacting with Codeception
Creating tests
Migrations on the test database
Summary
4. Isolated Component Testing with PHPUnit
Understanding the work to be done
Using the User model
Implementing the first unit test
How much to care for other people's code
Component testing of the model
What's testing for PHPUnit
Testing the methods inherited by IdentityInterface
Using data providers for more flexibility
Using fixtures to prepare the database
Adding the remaining tests
Implementing the ActiveRecord class and its methods
Dealing with migrations
The Gii code generation tool
Seeing tests pass
Using global fixtures
Summary
5. Summoning the Test Doubles
Dealing with external dependencies
Isolating components with stubs
Listening for calls with an observer
Introducing mocking
Getting to know the Yii virtual attributes
Writing maintainable unit tests
Using BDD specification testing
Summary
6. Testing the API – PHPBrowser to the Rescue
Functional tests in Yii 2
Understanding and improving the available CEPTs
Writing reusable page interactions
Implementing fixtures
Pitfalls of functional tests
Functional tests for REST interfaces
Defining the API endpoints
Implementing the tests for the API
Creating a RESTful web service with Yii 2
Writing modular code in Yii
Creating a module with Gii
Using modules in Yii 2
Converting our controller to be a REST controller
Adding the access check and security layer
Building the authentication layer
Modifying the existing actions
Adding a new endpoint with parameters
Summary
7. Having Fun Doing Browser Testing
Introducing Selenium WebDriver
Installing and running Selenium Server
Configuring Yii to work with Selenium
Implementing WebDriver-led tests
Creating acceptance tests
Implementing the modal window
Making the server side work
Adding the JavaScript interaction
Tying everything together
Dealing with Yii 2 assets bundles
Finalizing the tests
Testing multiple browsers
Understanding Selenium limits
Summary
8. Analyzing Testing Information
Improving the quality of your tests
Enabling code coverage in Codeception
Extracting the code coverage information for unit tests
Generating a detailed coverage report of the unit tests
Aggregating functional tests to unit tests
Generating acceptance tests' coverage report
Improving our code with the aid of additional tools
Summary
9. Eliminating Stress with the Help of Automation
Automating the build process
Introducing continuous integration systems
Available systems
Installing and configuring Jenkins
Understanding the Jenkins organization
Installing the required plugins
Creating the required build files
Understanding the basic Ant structure
Adjusting the build.xml file
Preparing the environment for the build
Adding the required configuration settings
Adding Composer, Yii, and Codeception support in Ant
Configuring the Jenkins build
Generic build settings
Build settings
Postbuild settings
Executing the job
Going forward
Summary
Index

Learning Yii Testing

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2015
Production reference: 1240415
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78439-227-7
www.packtpub.com

Credits

Author
Matteo Pescarin
Reviewers
Tristan Bendixen
Jesús Peña Cadena
Mark Katkov
Samuel Liew
Commissioning Editor
Akram Hussain
Acquisition Editors
James Jones
Greg Wild
Content Development Editor
Rahul Nair
Technical Editor
Taabish Khan
Copy Editors
Hiral Bhat
Tani Kothari
Vikrant Phadke
Sameen Siddiqui
Trishla Singh
Laxmi Subramanian
Project Coordinator
Suzanne Coutinho
Proofreaders
Stephen Copestake
Safis Editing
Indexer
Hemangini Bari
Production Coordinator
Komal Ramchandani
Cover Work
Komal Ramchandani

About the Author

Matteo Pescarin started his career as a filmsetter. He cofounded a digital agency in 1998 with Emanuele Tozzato and became an expert in Flash in 2001, giving talks and writing guides on it. He later decided to distance himself from closed source technologies and committed himself to open standards and open source, joining the Gentoo Channel Italia, an Italian-wide Linux User Group dedicated to the famous distro. He became passionate about HTML and XML-related semantic technologies, combining, once again, his passion for 2D graphics with programming.
Matteo moved to London, UK, in 2009 after getting a CS degree. While still working on LAMP technologies, he started learning and specializing on the project manag...

Inhaltsverzeichnis