Test network code using Java

Source: Internet
Author: User

Network code has proved that it is difficult to perform a thorough test, because the test component does not depend on other servers and works as an independent process for the best time. In this article, Nelson Minar describes two methods for unit test network code. First, he suggested that you should be logically independent from the network when designing network code. Next, he suggested using the Java protocol processor class to simulate Network Connections instead of using the actual network. With these principles, you can easily generate network testing software.
Testing network code is very difficult. ExcellentUnit TestThe component runs very quickly, so that developers can perform tests after each compilation. Of course, the test stream must also run stably so that they can continuously capture any errors in the code. However, practice has proved that it is difficult to quickly and stably test network code (for example, Code read from a URL. Moreover, if the test component performs network calling, the test will become very slow and unstable because of the network dependency and other servers.

Read: http://www.javah.net/wangluobiancheng/20070611/2618.html

Related Article

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.