10-测试与调试

10-测试与调试

10-测试与调试

10.1 单元测试

class Calculator { fun add(a:Int,b:Int)=a+b }

class CalculatorTest {
    @Test fun add() { assertEquals(3, Calculator().add(1,2)) }
}

10.2 UI 测试(Espresso)

onView(withId(R.id.tvHello)).check(matches(withText("Hello")))

10.3 调试与分析

  • Logcat、Debugger、Profiler(CPU/内存/网络)。
文章版权声明:除非注明,否则均为边学边练网络文章,版权归原作者所有
  • 上一篇:
  • 下一篇: