Testing methods can be categorized by the development process.
- Behavior Driven Development
- Functional testing
- Acceptance testing
- Test Driven Development
- Unit testing
- Integration testing
TDD: In Test Driven Development developers first write the tests and then write code that passes the tests.
- Unit testing: Is a TDD based process which covers testing of the whole project at module level. This way you can be sure that some deeply hidden feature works correctly. In unit testing each module is tested as a unit (each function in class has its test case).
- Integration testing: Testing modules after integrating them together.
BDD: Is an extension of TDD which allows developers to write tests based on behavior or functionality of the code/project.
- Acceptance Tests: Acceptance tests are generally performed by clients/users and non-technical persons who don’t know database, web-server, or programming language you use or why the application did not behave as expected. Acceptance tests can cover standard, but complex scenarios from a user’s perspective.
- Functional Testing: Functionality testing is performed to verify that an application performs and functions correctly according to design specifications and requirements.
Some interesting testing tools:-
- PhpUnit: Basic unit testing framework for PHP. Follows TDD process in which developers should write test classes before writing the functionality of any class. Every class has various test cases for each member function. Laravel has a PHPUnit package for unit testing of laravel applications. Laravel 5.1 has inbuilt methods for form and database testing.
- SimpleTest: Unit testing framework. It includes all of the typical functions you would expect from the PHPUnit ports.
- Codeception: Most flexible testing framework. You can perform acceptance, functional and unit testing using this framework. Provides a functional environment for testing APIs and BDD testings. Read more about codeception.
- Selenium: Automation testing tool for BDD. Runs automation testing on Firefox browser. An add-on is available for the Firefox browser which allows us to define test suites and runs that test suites on the browser. A framework for selenium is also available. It is an open-source software. Read more about Selenium.
Testing is an important part of any project. It allows you to deliver bug free project and also makes You can read Laravel testing decoded a book by Jeffery Way.
Chech how to perform unit testing in Laravel using PhpUnit.