Android

การทดสอบ Android

JUnit, Espresso, unit test, instrumented test, assertion

28 คำถามสัมภาษณ์·
Junior
1

JUnit คืออะไร?

คำตอบ

JUnit คือ framework สำหรับ unit testing สำหรับ Java และ Kotlin เป็นมาตรฐานสำหรับการเขียนและรัน test อัตโนมัติ JUnit 4 ใช้ annotation (@Test, @Before, @After) เพื่อกำหนด test และ lifecycle ของพวกมัน Test JUnit เร็วเพราะรันบน JVM ในเครื่องโดยไม่ต้องใช้ Android emulator

2

annotation @Test ใช้สำหรับอะไร?

คำตอบ

@Test ทำเครื่องหมายเมธอดเป็น unit test เมธอดจะถูกรันโดย test runner หากไม่มี @Test เมธอดจะถูกเพิกเฉย ตัวอย่าง: @Test fun testAddition() { assertEquals(4, 2 + 2) } แต่ละ @Test ต้องเป็นอิสระและไม่ขึ้นอยู่กับลำดับการรัน

3

annotation @Before ใช้สำหรับอะไร?

คำตอบ

@Before ทำเครื่องหมายเมธอดที่รัน ก่อน แต่ละ test (@Test) มีประโยชน์สำหรับการเริ่มต้นออบเจกต์ทั่วไป สร้าง mock รีเซ็ตสถานะ ตัวอย่าง: @Before fun setUp() { viewModel = MyViewModel() } หากคุณมี 5 test, @Before จะรัน 5 ครั้ง ทางเลือก: @BeforeClass สำหรับการรันครั้งเดียวก่อน test ทั้งหมด

4

annotation @After ใช้สำหรับอะไร?

5

assertion ใน testing คืออะไร?

+25 คำถามสัมภาษณ์

หัวข้อสัมภาษณ์ Android อื่นๆ

พื้นฐาน Android

Junior
24 คำถาม

UI และทรัพยากร Android

Junior
30 คำถาม

Lifecycle ของ Android

Junior
30 คำถาม

การนำทาง Android

Junior
26 คำถาม

การจัดการข้อมูล Android

Junior
29 คำถาม

Networking Android

Junior
29 คำถาม

Android Gradle

Junior
26 คำถาม

พื้นฐานภาษา Kotlin สำหรับ Android

Junior
24 คำถาม

Room Database

Mid-Level
25 คำถาม

การทำงานเบื้องหลัง

Mid-Level
18 คำถาม

Jetpack Compose

Mid-Level
28 คำถาม

สิทธิ์และฟีเจอร์ของอุปกรณ์

Mid-Level
21 คำถาม

Firebase สำหรับ Android

Mid-Level
23 คำถาม

Android MVVM Architecture

Mid-Level
18 คำถาม

เครือข่าย Android ขั้นสูง

Mid-Level
13 คำถาม

Collections และ Operators ใน Kotlin

Mid-Level
20 คำถาม

Kotlin Coroutines และ Flow

Mid-Level
20 คำถาม

การฉีด Dependency ใน Android

Mid-Level
15 คำถาม

Android MVI Architecture

Mid-Level
17 คำถาม

Android Clean Architecture

Senior
21 คำถาม

Android Compose ขั้นสูง

Senior
17 คำถาม

Android Performance and Monitoring

Senior
13 คำถาม

Android Security and Privacy

Senior
18 คำถาม

Android CI/CD and Release

Senior
15 คำถาม

Android UX and Form Factors

Senior
18 คำถาม

Android Testing Advanced

Senior
18 คำถาม

เชี่ยวชาญ Android สำหรับการสัมภาษณ์ครั้งถัดไป

เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์

เริ่มใช้ฟรี