junit--Unit Test Steps

Source: Internet
Author: User

steps:

1. New package (generally named *. Test, the testing class and the development class are placed in different packages)
2. New JUnit Text case (generally named *test)
3. Select the method you want to test

4. You can download the latest jar package, or you can select the system's own: www.junit.org Static Introduction:import static org.junit.assert.*; a static class (not a jar package) is introduced in the test program, which is the import static org.junit.assert.*, where assert is the meaning of the assertion (judgment), and we can use the functions in this class to implement the judgment function. The benefit of introducing this class is that assertequals (8,z) can be used directly in the following statement without the need to add an assert.
use Assertequals (8,z); The benefits of assertions:
(1) The color of the progress bar (bar) can be visualized to determine whether the test passed;
(2) If there are two methods, you can run at the same time, which is not done with main test;
(3) You need to manually judge, the program automatically complete the judgment.
Note: After a static introduction, you do not need to precede the corresponding class as long as you directly take advantage of the method.

junit--Unit Test Steps

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.