How do unit tests and functional tests help WEB Application development

  question

A preliminary understandingPHPUnitFeeling
unit testingIs to use a test class, simulate the browser to fill in the form, submit the form, test whether the normal operation can be successful.
functional testNot yet.

I think PHPUnit is not very useful for a small website.
What is the right scale to use PHPUnit?

I think PHPUnit cannot test out some potential hidden troubles and bugs (submitting unexpected form data, etc.). Writing a test class is not as good as opening a browser test yourself, is it?

In addition, we can say that we have experience and feelings in using PHPUnit.

First of all, answer your first point, unit tests you said to submit under the browser form simulation, this is not wrong, but with the form simulation submission, may not be able to cover all your code logic, unit tests pay attention to coverage, general normal enterprise, the coverage rate is required to be more than 80%;

Second, if manual intervention is required for each unit test run, the unit test will have little significance. Generally, after you finish writing your modules, you will write the test code separately, and then you will give your tool “Continuous Integration” to complete the following steps. Only you submit an SVN version number and then go back from work. The next day, after the continuous integration runs, you will be listed with the unit test results and some other problems of the code, such as Cyclomatic complexity, number of lines of code, etc. …

Third, general small websites do not need to waste time writing unit tests, because unit tests take a lot of time, and the time for writing business is usually 1:1. Therefore, like large websites, the security requirements are relatively high, or the unit test scripts will only be written if they are large enough to split the application layer modules. Otherwise, small companies cannot spend this time to do this, after all, the time cost is equivalent to the programmer’s salary.

I wonder if such an answer has solved your doubts?