How does unit test and function test help WEBApplication development?

Source: Internet
Author: User
I have a preliminary understanding of PHPUnit. I feel that unit testing is to use a test class to simulate entering a form in a browser and submitting a form to test whether the normal operation is successful. The function test is not available yet. I think, isn't PHPUnit very useful for a small website? What should I do? PHPUnit, Feeling
Unit TestA test class is used to simulate entering a form in a browser and submitting a form to test whether the normal operation is successful.
Function TestingNot yet understood.

I think, isn't PHPUnit very useful for a small website?
What scale should I use PHPUnit to achieve?

I think PHPUnit cannot test some potential risks and bugs (submit unexpected form data, etc ). Isn't it better to open your browser to test a test class?

In addition, it can be said that PHPUnit has experience and feelings.

Reply content:

Have a preliminary understandingPHPUnit, Feeling
Unit TestA test class is used to simulate entering a form in a browser and submitting a form to test whether the normal operation is successful.
Function TestingNot yet understood.

I think, isn't PHPUnit very useful for a small website?
What scale should I use PHPUnit to achieve?

I think PHPUnit cannot test some potential risks and bugs (submit unexpected form data, etc ). Isn't it better to open your browser to test a test class?

In addition, it can be said that PHPUnit has experience and feelings.

First of all, let's answer your first question. unit test you said that you could use the browser form to simulate the submission. This is not an error. However, using the form to simulate the submission may not cover all your code logic, unit testing focuses on coverage. Generally, regular enterprises require a coverage rate of over 80%;

Second, IF Manual Interference is required for each unit test, this unit test is meaningless. Generally, you write your modules and then write the test code separately, the subsequent steps will be completed by the tool "continuous integration". You only need to submit an SVN version number, and then go back from work. The next day, after the continuous integration is completed, it will list the unit test results and some other code problems, such as the complexity of the circle, the number of lines of code, and so on...

Third, General small websites do not need to waste time writing unit tests, because unit tests are very time-consuming. Generally, the time for business writing is. Therefore, for large websites, A high security requirement, or a unit test script is written only when the modules at the application layer need to be split. Otherwise, it is impossible for a small company to spend the time doing this, after all, the time cost is equivalent to the programmer's salary.

I don't know if this answer solves your doubts?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.