In the production environment, we have to make sure that applications are working properly every time we add new features or make fixes in the current codebase, this can be done using automated testing procedures. There are various software testing suites and one popular is codeception. The codeception can be installed locally to your project folder or globally in your development machine.

Installing Codeception Test

this task can be done easily using a package manager like php composer. In case of local installation in command line, we type the following and only for the global case we add the flag global after the require command

composer require "codeception/codeception=2.1.*" 
composer require "codeception/specify=*"
composer require "codeception/verify=*"

gloabal case composer require global "codeception/codeception=2.1.*"

In global machine installation, you can check the packages of composer as typing the following

composer global status

In the global case the packages from composer are installed in the home directory in a hidden folder called .composer let's find it

cd ~/.composer

then we have to add this directory ~/.composer/vendor/bin to the path PATH environment variable in ~/.profile file

add the following 
export PATH=$PATH:~/.composer/vendor/bin

Now we can write tests and execute the from the command line using codecept from the command line.

3 Types of Test

These three types of tests unit, functional and acceptance Tests. Unit tests are used to verify the correct functionality of small parts of code, for example, a unit test can test function methods against various inputs against the expected results.

Functional test is testing the functionality of using various scenarios that a user do in the applications. Acceptance test is almost the same as functional but the execution can be inside on browser where we can see a visual of testing flow while the test running application. If you want to run the acceptance tests

codecept run acceptance


So before adding new features in production server we will have to run first all the tests and then we deploy new features with confidence that the application work perfectly. How we run the test could be a part of our deployment strategy but to have detailed reporting we have first to have set up a  Continuous Integration system like Jenkins, Travis CI and even Gitlab can execute the test return reports if there is the file .gitlab-ci.yml