About unit testing in Android/ios development

Source: Internet
Author: User
Many developers, especially small-business developers, have basically never used unit tests, thinking that direct development is fast and good, and that unit testing is a waste of time and effort. But big companies, on the contrary, value unit tests more. Because the code for unit testing is relatively stable and reliable, and if developers are accustomed to testing-driven development, it would be nice to see that.
Test-Driven Development mode is: Before development, think about what to do first, and then the external interface design, you can first write unit test code. After the development of the actual code, after the development, run again before the unit test, if the failure of debugging, until the final success, will give developers a unique sense of achievement.
Unit testing is also especially good for agile development, and when you develop new functionality, you don't know if it will affect previously stable functionality. Of course, you can manually test, but a two times manual test is no problem, more will be found or unit test is good, automatic run again on the line, more in line with the good programmer good use of tools of excellent quality.
Unit test tools, using JUnit plus ant script on Android, using Ocunit or Ghunit on iOS. Although the tools are different, but the idea is similar.
Of course, not all projects must be the best unit test. My previous project, useful unit test, also have not, here summarizes the use of Unit Test 2 principles.
1. Principle of the scale of the project. If it is a small project, the development of the end of the throw to the customer, the late basic maintenance. That is biased in favor of direct development, very fast and good, you do unit Test no more customers can not see, do quickly also be praised by customers. If it's a big project, when you do the nth module, the details of the 1th module are almost forgotten, and then unit tests can help you confirm the reliability of the front module.
2. The principle of individual varies. Everyone's development level and personality is not the same, some people are cautious nature, the development of code bugs Less, some people are more extensive, the bug is relatively much more. With bugs you need to test and debug, and when testing and debugging are larger than development time, it is recommended that the next project be developed using unit test mode. Unit tests let you discover problems in your code as early as possible, and the sooner bugs are found, the easier it is to solve them.
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.