English 中文(简体)
Running Tests In Android Studio
  • 时间:2024-03-24 05:01:54

Running Tests In Android Studio


Previous Page Next Page  

在本章中,让我们看看如何使用安乐施室进行测试。

每一种甲状腺应用都有两种类型的检测:

    职能/单位测试

    仪器测试

Functional test does not need the actual android apppcation to be installed and launched in the device or emulator and test the functionapty. It can be launched in the console itself without invoking the actual apppcation. However, instrumentation tests need the actual apppcation to be launched to test the functionapty pke user interface and user interaction. By default, Unit tests are written in src/test/java/ folder and 仪器测试 are written in src/androidTest/java/ folder. Android studio provides Run context menu for the test classes to run the test written in the selected test classes. By default, an Android apppcation has two classes − ExampleUnitTest in src/test folder and ExampleInstrumentedTest in src/androidTest folder.

为了进行缺席单位测试,选定ExampleUnit Test,在安伯顿演播室进行右侧扫描,然后点击Run ExampleUnit Test如下:

Android Studio

Run Unit Test

它将进行单位测试,并显示像以下屏幕显示的青 the的结果:

Test And Show

Unit Test Success

进行缺省仪器测试,选定实例说明 and室试验,右侧扫描,然后点击鲁普勒入侵试验,如下所示:

Instrumentation Test

Run Instrumentation Test

这将通过在任何装置或推介器上启动申请来进行单元测试,并显示像以下屏幕显示的青 the的结果:

Unit Test

仪器测试取得了成功。

Advertisements