How Android Studio uses unit tests (no device required)

Source: Internet
Author: User

With regard to the use of unit tests, sometimes it is necessary to detect the feasibility and correctness of code logic in the process of writing code, and do not want to run through the device, so you can run the code through unit tests ~

1, first build Android studio Android project;

2, you can see there are 3 different categories of code folders

The first one is the real project folder, the second is a folder based on the Android device Unit test, and the third is a Java Virtual machine based unit Test folder

3. Add test code to test

Select "Test" folder, direct Ctrl + SHIFT + F10 run (or go to Exampleunittest class, right-click,Run ' exampleunittest ')

The results are as follows:

How Android Studio uses unit tests (no device required)

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.