PersonService.java
01package com.android.junit.service;
02
03public class PersonService {
04
05 public int addPerson(){
06 int i=1;
07 int k=2;
08 int h=i+k;
09 // int y=h/0;
10 return h;
11 }
12}
PersonServiceTest.java
01package com.android.junit.activity;
02
03import com.android.junit.service.PersonService;
04
05import android.test.AndroidTestCase;
06import android.util.Log;
07
08public class PersonServiceTest extends AndroidTestCase {
09
10 // 第一个 办法 无返回值 办法名 test(固定)+测验办法
11 public void testAddPerson(){
12 PersonService personService=new PersonService();
13 int result=personService.addPerson();
14 System.out.println(result=+result);
15 Log.i(test, result=+result);
16 }
17}
留意: