0% found this document useful (0 votes)
11 views15 pages

PHP Unit Testing and TDD Guide

This document provides an introduction to unit testing for PHP developers. It discusses that unit testing involves testing code in isolated bits and pieces during development to find and fix bugs without needing quality control. It outlines different types of tests including unit, functional, integration, end-to-end, and acceptance tests. The document also introduces test-driven development (TDD) as writing tests before code to ensure features pass tests, and mentions PHPUnit as a tool for testing PHP code.

Uploaded by

sharmabastola
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views15 pages

PHP Unit Testing and TDD Guide

This document provides an introduction to unit testing for PHP developers. It discusses that unit testing involves testing code in isolated bits and pieces during development to find and fix bugs without needing quality control. It outlines different types of tests including unit, functional, integration, end-to-end, and acceptance tests. The document also introduces test-driven development (TDD) as writing tests before code to ensure features pass tests, and mentions PHPUnit as a tool for testing PHP code.

Uploaded by

sharmabastola
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

WELCOME TO TESTING

FOR PHP
DEVELOPERS
WHAT IS UNIT-TESTING

▸ Testing is majorly as we understand a SR assigned to QC! ->


Jitendra Dai
▸ Testing is majorly refreshing the browser to look if our code
worked or not?
▸ Testing is majorly not being sure about how will our code behave
in certain environments, say production or development.
▸ Testing is pulling the code from production putting var_dump() in
places, desiring the output why the code is not producing.
BUT SORRY!!

THAT IS NOT
UNIT-TESTING
WHAT IS TESTING

▸ It is the industrial approach for writing code.


▸ It is the operating of the code you write in bits and pieces.
▸ It is busting bugs, in the development phase, without the
help of QC.

▸ It is being happy and feeling wonderful about the code you


write.
TYPES OF TESTS

▸ Unit Testing
▸ Functional Testing
▸ Integration Testing
▸ End to End Testing
▸ Selenium Testing
▸ Acceptance Testing
▸ Smoke Testing
HOW??

CAN I PRACTICE
UNIT-TESTING
TDD
TEST DRIVEN
DEVELOPMENT
WHAT IS TDD

▸ TDD is Test Driven Development


▸ TDD is not black magic.
▸ TDD is the loop of software development.
▸ TDD is not writing production code until the tests go green.
▸ TDD can’t be applicable where you ship features in one night.
▸ TDD can be hard to master but when done correctly makes you
a better developer.
TOOLS FOR TESTING PHP CODES

▸ var_dump($someThing);
▸ print_r($someBuggyLine);
▸ print_r($data);
▸ echo $sql;
▸ die();
▸ exit;
▸ x-debug?
▸ others??
BUT SORRY!!! AGAIN

THOSE
PHP-UNIT
CODE -
CEPTION
Spot The Difference
THINGS NEEDED TO KEEP IN MIND BEFORE WRITING UNIT TESTS

▸ Test codes are always more than production codes.


▸ Testing makes software development a lengthy process, at
first but it is not.

▸ You will be a better programmer/coder if you write tests for


your code.

▸ Your fellow developer can also understand what is the code


intending to do if can read the tests.

You might also like