Java知识分享网 - 轻松学习从此开始!    

Java知识分享网

Java1234官方群25:java1234官方群17
Java1234官方群25:838462530
        
SpringBoot+SpringSecurity+Vue+ElementPlus权限系统实战课程 震撼发布        

最新Java全栈就业实战课程(免费)

springcloud分布式电商秒杀实战课程

IDEA永久激活

66套java实战课程无套路领取

锋哥开始收Java学员啦!

Python学习路线图

锋哥开始收Java学员啦!
当前位置: 主页 > Java文档 > Java基础相关 >

Android Programming The Big Nerd Ranch Guide 第五版 PDF 下载


分享到:
时间:2023-12-24 10:43来源:http://www.java1234.com 作者:转载  侵权举报
Android Programming The Big Nerd Ranch Guide 第五版
失效链接处理
Android Programming The Big Nerd Ranch Guide 第五版 PDF 下载

 
 
 
相关截图:
 


主要内容:


Instrumented Tests with Espresso and
ActivityScenario
Let’s move on to instrumented tests. Begin by checking out the example
that Android Studio created. In
com.bignerdranch.android.geoquiz (androidTest), find
and open ExampleInstrumentedTest.kt:
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.bignerdranch.android.geoquiz", appContext.packageName)
}
}
Much of this code is similar to the tests you have seen so far: You have a
class containing a function annotated with @Test, and within that function
there is an assertion to verify some behavior. But there are also some
differences: First, the class itself has an annotation,
@RunWith(AndroidJUnit4::class), which signals to JUnit that
this test should be executed on an Android device. And the test function
relies on the Android SDK, specifically to verify that the app’s package
name is the same as the value you set when you created the app.
You are about to run ExampleInstrumentedTest, but you have some
housekeeping to take care of first. Since instrumented tests run on an
Android device, not your development machine, you need to either connect
an Android device, as you did in Chapter 2, or run an emulator. Make sure
the device dropdown at the top of the Android Studio window shows the
 


 
 
 
------分隔线----------------------------

锋哥公众号


锋哥微信


关注公众号
【Java资料站】
回复 666
获取 
66套java
从菜鸡到大神
项目实战课程

锋哥推荐