万本电子书0元读

万本电子书0元读

顶部广告

Learning Yii Testing电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Matteo Pescarin

出  版  社:Packt Publishing

出版时间:2015-04-28

字       数:148.1万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Developers who have a solid pre-existing knowledge of Yii's core concepts will find this book an ideal introduction to learning to write tests using Yii 2's tools. You'll learn to create faster and more reliable applications with less time and effort.
目录展开

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

累计评论(0条) 1个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部