Androidでテストってどないすんねん!

376 views

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
376
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Androidでテストってどないすんねん!

  1. 1. サンプル:http://books.ascii.jp/9784048860680/2013/03/15 
  2. 2. ✤ ✤ ✤ ✤✤ ✤ ✤
  3. 3. ✤ ✤ ✤
  4. 4. ✤ ✤ ✤ ✤✤ ✤
  5. 5. ! !! !
  6. 6. ※抜け漏れあり ※リスクベースである程度の  取捨選択が現実的(自己弁護)テストケース番号 入力値 ユニットテスト UIテスト 検証項目 出力メッセージ(メソッド名) (辺a, 辺b, 辺c) で検証 で検証
  7. 7. public class TriangleTest extends TestCase { public void test01() { Triangle testee = new Triangle(2,3,4); assertEquals(Triangle.Type.SCALENCE, testee.checkType()); } public void test02() { Triangle testee = new Triangle(1,2,2); assertEquals(Triangle.Type.ISOSCELES, testee.checkType()); } public void test03() { (割愛)  } public void test04() { (割愛)  } public void test05() { try { Triangle testee = new Triangle(1,2,3); fail("Wrong instance: " + testee.checkType().toString()); } catch (RuntimeException e) { assertEquals(" ",e.getMessage()); } }}
  8. 8. public class TriangleActivityTest extends TestCase {  (テストメソッド以外は割愛) public void test01() { driver.startActivity(TESTEE); // テスト対象の絶対クラスパスを文字列で指定 inputText("editText_a", "2"); inputText("editText_b", "3"); inputText("editText_c", "4"); assertTrue(driver.findElement(By.id("do_check")).isEnabled()); buttonClick(); assertEquals("", driver.findElement(By.id("error_message")).getText()); assertEquals(" ", driver.findElement(By.id("result_message")).getText()); } public void test06() { (test06とほぼ同じ ! 割愛) } public void test06() { driver.startActivity(TESTEE); inputText("editText_a", "a"); inputText("editText_b", "2"); inputText("editText_c", "2"); assertFalse(driver.findElement(By.id("do_check")).isEnabled()); assertEquals("", driver.findElement(By.id("result_message")).getText()); assertEquals(" ", driver.findElement(By.id("error_message")).getText()); }}
  9. 9. ✤✤ サンプル:http://books.ascii.jp/9784048860680/      “ch3/3-3/”
  10. 10. ✤✤✤ ✤
  11. 11. ✤ ✤ ✤ ✤ ✤

×