Quality assurance testing is an important part of any import web application. Especially when the web app is running in a production environment, to ensure that the web app is running smoothly every time, we add new features that do not affect other parts of the systems. So creating a testing plan is one of the first steps that we have to create.
This is the job of a QA engineer but in small and medium projects could be performed by a senior web developer. This process could be developed separately from the development phase or during dev using methodologies like Test-Driven Development (TDD) and Behavior-Driven Development (BDD). So codeception could be used standalone or in yii web development project
Testing Process
The first steps for designing a testing plan is t
- Planning
- Executing
- Checking
- Act
But for preventing bugs, errors and a fault in applications is can be reduced significantly buy using automated testing.
If we use automated testing procedures with one step build we ensure healthy apps. There are various software testing suites and one popular is Codeception. The Codeception can be installed locally to the project's folder or globally in the operating machine.
Software testing using Codeception Suites
First we have to install codeception package using a dependency manager for php the composer. In case of local installation in the command line, we type the following and only for the global case we add the flagging global after the require command
composer require "codeception/codeception=2.1.*"
composer require "codeception/specify=*"
composer require "codeception/verify=*"
global 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
~/.bashrc
add the following
export PATH=$PATH:~/.composer/vendor/bin
Now we can write tests and execute them from the command line using codecept from the command line.
Software testing types on web apps
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.
A functional test is testing the functionality of using various scenarios that a user do in the applications. The 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
Conclusion
So before adding new features in the production server we will have to run first all the tests and then we deploy new features with confidence that the application works perfectly. How we run the test could be a part of our deployment strategy that could to orchestrate the deployment executions of the test scripts with a deployment tool like capistrano , maven or with Continuous Integration systems like Jenkins, Travis CI, and even Gitlab can execute the test return reports if there is the file gitlab-ci.yml.
Deploying your web applications in confidence with software testing automation is important to any project.