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.