Enviar búsqueda
Cargar
Atec mtg7 unittest
•
3 recomendaciones
•
1,287 vistas
Koji Hasegawa
Seguir
Vista de diapositivas
Denunciar
Compartir
Vista de diapositivas
Denunciar
Compartir
1 de 56
Descargar ahora
Descargar para leer sin conexión
Recomendados
Code Samples
Code Samples
Bill La Forge
Quickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop Applications
Clare Macrae
PushToTest TestMaker 6.5 Open Source Test Design Document
PushToTest TestMaker 6.5 Open Source Test Design Document
Clever Moe
Testing basics for developers
Testing basics for developers
Anton Udovychenko
Junit 5 - Maior e melhor
Junit 5 - Maior e melhor
Tiago de Freitas Lima
The real beginner's guide to android testing
The real beginner's guide to android testing
Eric (Trung Dung) Nguyen
Unit testing with Qt test
Unit testing with Qt test
Davide Coppola
JUnit 5 - The Next Generation
JUnit 5 - The Next Generation
Kostadin Golev
Recomendados
Code Samples
Code Samples
Bill La Forge
Quickly Testing Qt Desktop Applications
Quickly Testing Qt Desktop Applications
Clare Macrae
PushToTest TestMaker 6.5 Open Source Test Design Document
PushToTest TestMaker 6.5 Open Source Test Design Document
Clever Moe
Testing basics for developers
Testing basics for developers
Anton Udovychenko
Junit 5 - Maior e melhor
Junit 5 - Maior e melhor
Tiago de Freitas Lima
The real beginner's guide to android testing
The real beginner's guide to android testing
Eric (Trung Dung) Nguyen
Unit testing with Qt test
Unit testing with Qt test
Davide Coppola
JUnit 5 - The Next Generation
JUnit 5 - The Next Generation
Kostadin Golev
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
shaunthomas999
Deep dive into Android async operations
Deep dive into Android async operations
Mateusz Grzechociński
Junit4&testng presentation
Junit4&testng presentation
Sanjib Dhar
Why Spring <3 Kotlin
Why Spring <3 Kotlin
VMware Tanzu
Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016
Mike Nakhimovich
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
Sam Brannen
Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with Eclipse
Coen De Roover
Dagger 2 - Injeção de Dependência
Dagger 2 - Injeção de Dependência
Edson Menegatti
CDI: How do I ?
CDI: How do I ?
Antonio Goncalves
Overview of Android Infrastructure
Overview of Android Infrastructure
Alexey Buzdin
Junit and testNG
Junit and testNG
Марія Русин
Test ng
Test ng
fbenault
Android MvRx Framework 介紹
Android MvRx Framework 介紹
Kros Huang
Android Loaders : Reloaded
Android Loaders : Reloaded
cbeyls
Spring framework part 2
Spring framework part 2
Skillwise Group
Introduction to TDD with FlexUnit
Introduction to TDD with FlexUnit
Anupom Syam
Basic VR Development Tutorial Integrating Oculus Rift and Razer Hydra
Basic VR Development Tutorial Integrating Oculus Rift and Razer Hydra
Chris Zaharia
UnityによるVR開発 - 入力デバイス編 -
UnityによるVR開発 - 入力デバイス編 -
Tomonori Takata
建築VRを作る方法 | SketchUp研究会 第4回定例会
建築VRを作る方法 | SketchUp研究会 第4回定例会
Tomonori Takata
Xcode 7におけるUIテストとカバレジ計測 #yidev 第20回勉強会
Xcode 7におけるUIテストとカバレジ計測 #yidev 第20回勉強会
Koji Hasegawa
Oculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion Tutorial
Chris Zaharia
VRの入力デバイス #JAGVR
VRの入力デバイス #JAGVR
Koji Hasegawa
Más contenido relacionado
La actualidad más candente
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
shaunthomas999
Deep dive into Android async operations
Deep dive into Android async operations
Mateusz Grzechociński
Junit4&testng presentation
Junit4&testng presentation
Sanjib Dhar
Why Spring <3 Kotlin
Why Spring <3 Kotlin
VMware Tanzu
Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016
Mike Nakhimovich
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
Sam Brannen
Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with Eclipse
Coen De Roover
Dagger 2 - Injeção de Dependência
Dagger 2 - Injeção de Dependência
Edson Menegatti
CDI: How do I ?
CDI: How do I ?
Antonio Goncalves
Overview of Android Infrastructure
Overview of Android Infrastructure
Alexey Buzdin
Junit and testNG
Junit and testNG
Марія Русин
Test ng
Test ng
fbenault
Android MvRx Framework 介紹
Android MvRx Framework 介紹
Kros Huang
Android Loaders : Reloaded
Android Loaders : Reloaded
cbeyls
Spring framework part 2
Spring framework part 2
Skillwise Group
Introduction to TDD with FlexUnit
Introduction to TDD with FlexUnit
Anupom Syam
La actualidad más candente
(16)
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
Deep dive into Android async operations
Deep dive into Android async operations
Junit4&testng presentation
Junit4&testng presentation
Why Spring <3 Kotlin
Why Spring <3 Kotlin
Sword fighting with Dagger GDG-NYC Jan 2016
Sword fighting with Dagger GDG-NYC Jan 2016
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
JUnit 5 - Evolution and Innovation - SpringOne Platform 2019
Logic-based program transformation in symbiosis with Eclipse
Logic-based program transformation in symbiosis with Eclipse
Dagger 2 - Injeção de Dependência
Dagger 2 - Injeção de Dependência
CDI: How do I ?
CDI: How do I ?
Overview of Android Infrastructure
Overview of Android Infrastructure
Junit and testNG
Junit and testNG
Test ng
Test ng
Android MvRx Framework 介紹
Android MvRx Framework 介紹
Android Loaders : Reloaded
Android Loaders : Reloaded
Spring framework part 2
Spring framework part 2
Introduction to TDD with FlexUnit
Introduction to TDD with FlexUnit
Destacado
Basic VR Development Tutorial Integrating Oculus Rift and Razer Hydra
Basic VR Development Tutorial Integrating Oculus Rift and Razer Hydra
Chris Zaharia
UnityによるVR開発 - 入力デバイス編 -
UnityによるVR開発 - 入力デバイス編 -
Tomonori Takata
建築VRを作る方法 | SketchUp研究会 第4回定例会
建築VRを作る方法 | SketchUp研究会 第4回定例会
Tomonori Takata
Xcode 7におけるUIテストとカバレジ計測 #yidev 第20回勉強会
Xcode 7におけるUIテストとカバレジ計測 #yidev 第20回勉強会
Koji Hasegawa
Oculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion Tutorial
Chris Zaharia
VRの入力デバイス #JAGVR
VRの入力デバイス #JAGVR
Koji Hasegawa
テストの種類とBDD #33testing
テストの種類とBDD #33testing
Koji Hasegawa
ビルドプロセスとCI #STAC2014
ビルドプロセスとCI #STAC2014
Koji Hasegawa
Destacado
(8)
Basic VR Development Tutorial Integrating Oculus Rift and Razer Hydra
Basic VR Development Tutorial Integrating Oculus Rift and Razer Hydra
UnityによるVR開発 - 入力デバイス編 -
UnityによるVR開発 - 入力デバイス編 -
建築VRを作る方法 | SketchUp研究会 第4回定例会
建築VRを作る方法 | SketchUp研究会 第4回定例会
Xcode 7におけるUIテストとカバレジ計測 #yidev 第20回勉強会
Xcode 7におけるUIテストとカバレジ計測 #yidev 第20回勉強会
Oculus Rift DK2 + Leap Motion Tutorial
Oculus Rift DK2 + Leap Motion Tutorial
VRの入力デバイス #JAGVR
VRの入力デバイス #JAGVR
テストの種類とBDD #33testing
テストの種類とBDD #33testing
ビルドプロセスとCI #STAC2014
ビルドプロセスとCI #STAC2014
Similar a Atec mtg7 unittest
Android Unit Test
Android Unit Test
Phuoc Bui
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
Konstantin Loginov
Java Unit Test and Coverage Introduction
Java Unit Test and Coverage Introduction
Alex Su
Android testing
Android testing
Sean Tsai
DevQuiz 2011 の模範解答 Android編
DevQuiz 2011 の模範解答 Android編
Makoto Yamazaki
Mock your way with Mockito
Mock your way with Mockito
Vitaly Polonetsky
Integration Group - Lithium test strategy
Integration Group - Lithium test strategy
OpenDaylight
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
beITconference
Robolectric Adventure
Robolectric Adventure
Eugen Martynov
Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)
Mobile Developer Day
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech Week
Paco van Beckhoven
Junit mockito and PowerMock in Java
Junit mockito and PowerMock in Java
Ankur Maheshwari
Android Building, Testing and reversing
Android Building, Testing and reversing
Enrique López Mañas
Testing and Building Android
Testing and Building Android
Droidcon Berlin
Testing Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UK
Fabio Collini
Testing Android apps based on Dagger and RxJava
Testing Android apps based on Dagger and RxJava
Fabio Collini
谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability
drewz lin
Successful Teams are TDD Teams
Successful Teams are TDD Teams
Rob Myers
Improve unit tests with Mutants!
Improve unit tests with Mutants!
Paco van Beckhoven
2. Design patterns. part #2
2. Design patterns. part #2
Leonid Maslov
Similar a Atec mtg7 unittest
(20)
Android Unit Test
Android Unit Test
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
Java Unit Test and Coverage Introduction
Java Unit Test and Coverage Introduction
Android testing
Android testing
DevQuiz 2011 の模範解答 Android編
DevQuiz 2011 の模範解答 Android編
Mock your way with Mockito
Mock your way with Mockito
Integration Group - Lithium test strategy
Integration Group - Lithium test strategy
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Robolectric Adventure
Robolectric Adventure
Automated integration tests for ajax applications (с. карпушин, auriga)
Automated integration tests for ajax applications (с. карпушин, auriga)
Mutation testing Bucharest Tech Week
Mutation testing Bucharest Tech Week
Junit mockito and PowerMock in Java
Junit mockito and PowerMock in Java
Android Building, Testing and reversing
Android Building, Testing and reversing
Testing and Building Android
Testing and Building Android
Testing Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava Droidcon UK
Testing Android apps based on Dagger and RxJava
Testing Android apps based on Dagger and RxJava
谷歌 Scott-lessons learned in testability
谷歌 Scott-lessons learned in testability
Successful Teams are TDD Teams
Successful Teams are TDD Teams
Improve unit tests with Mutants!
Improve unit tests with Mutants!
2. Design patterns. part #2
2. Design patterns. part #2
Más de Koji Hasegawa
Blender-like SceneView Hotkeys Unity extensions
Blender-like SceneView Hotkeys Unity extensions
Koji Hasegawa
IntelliJ plugin の作りかた
IntelliJ plugin の作りかた
Koji Hasegawa
AltUnityTesterを試してみた #gotandaunity
AltUnityTesterを試してみた #gotandaunity
Koji Hasegawa
スマートフォンアプリ開発と自動化 〜なじむ。実に!なじむぞ!〜 #AsianAA
スマートフォンアプリ開発と自動化 〜なじむ。実に!なじむぞ!〜 #AsianAA
Koji Hasegawa
スマートフォンアプリの色々自動化をはじめよう - at SonyDNA Meisters Salon 特別編
スマートフォンアプリの色々自動化をはじめよう - at SonyDNA Meisters Salon 特別編
Koji Hasegawa
iOSアプリ開発でもTravis CI #eytokyo
iOSアプリ開発でもTravis CI #eytokyo
Koji Hasegawa
テストフィクスチャTips(主にCoreData) #potatotips
テストフィクスチャTips(主にCoreData) #potatotips
Koji Hasegawa
Androidで使えるモックフレームワーク
Androidで使えるモックフレームワーク
Koji Hasegawa
スマートフォンアプリの テスト自動化をはじめよう
スマートフォンアプリの テスト自動化をはじめよう
Koji Hasegawa
第3回Ques ここからはじめる!Androidアプリのテスト自動化
第3回Ques ここからはじめる!Androidアプリのテスト自動化
Koji Hasegawa
Androidとの同時開発だけどモデルをC++で書けば問題ないよねっ
Androidとの同時開発だけどモデルをC++で書けば問題ないよねっ
Koji Hasegawa
Testterチーム2011年まとめ
Testterチーム2011年まとめ
Koji Hasegawa
Testter単体テストのビアレビュー報告
Testter単体テストのビアレビュー報告
Koji Hasegawa
山吹色の茸疾走におけるテストの実例
山吹色の茸疾走におけるテストの実例
Koji Hasegawa
Testterを叩け!
Testterを叩け!
Koji Hasegawa
Más de Koji Hasegawa
(15)
Blender-like SceneView Hotkeys Unity extensions
Blender-like SceneView Hotkeys Unity extensions
IntelliJ plugin の作りかた
IntelliJ plugin の作りかた
AltUnityTesterを試してみた #gotandaunity
AltUnityTesterを試してみた #gotandaunity
スマートフォンアプリ開発と自動化 〜なじむ。実に!なじむぞ!〜 #AsianAA
スマートフォンアプリ開発と自動化 〜なじむ。実に!なじむぞ!〜 #AsianAA
スマートフォンアプリの色々自動化をはじめよう - at SonyDNA Meisters Salon 特別編
スマートフォンアプリの色々自動化をはじめよう - at SonyDNA Meisters Salon 特別編
iOSアプリ開発でもTravis CI #eytokyo
iOSアプリ開発でもTravis CI #eytokyo
テストフィクスチャTips(主にCoreData) #potatotips
テストフィクスチャTips(主にCoreData) #potatotips
Androidで使えるモックフレームワーク
Androidで使えるモックフレームワーク
スマートフォンアプリの テスト自動化をはじめよう
スマートフォンアプリの テスト自動化をはじめよう
第3回Ques ここからはじめる!Androidアプリのテスト自動化
第3回Ques ここからはじめる!Androidアプリのテスト自動化
Androidとの同時開発だけどモデルをC++で書けば問題ないよねっ
Androidとの同時開発だけどモデルをC++で書けば問題ないよねっ
Testterチーム2011年まとめ
Testterチーム2011年まとめ
Testter単体テストのビアレビュー報告
Testter単体テストのビアレビュー報告
山吹色の茸疾走におけるテストの実例
山吹色の茸疾走におけるテストの実例
Testterを叩け!
Testterを叩け!
Atec mtg7 unittest
1.
2011.05.25 ATEC Mtg#7 2011
5 26
2.
• Twitter id
@nowsprinting • • • Java, Swing, Do-Ja, iOS SIer/ 2011 5 26
3.
Agenda
• • JUnit • Android Testing Framework • Android Mock 2011 5 26
4.
2011
5 26
5.
©snsk
at ATEC Mtg#1 2011 5 26
6.
©snsk
at ATEC Mtg#1 2011 5 26
7.
2011
5 26
8.
Activity
Http Lib (Mock) Lib (Mock) 2011 5 26
9.
→
Monkey God Hand Runner Activity Http Lib (Mock) Lib (Mock) Robolectric AndroidTest 2011 5 26
10.
→
Android Activity Monkey → God Hand Runner →suspend→resume Activity Http Lib (Mock) Lib (Mock) Robolectric AndroidTest 2011 5 26
11.
→
Monkey Instrumental God Hand Runner TestCase Activity Http Lib (Mock) Lib (Mock) Robolectric AndroidTest 2011 5 26
12.
JUnit
• Android Testing Framework JUnit3 • TestCase • TestCase Assertion 2011 5 26
13.
TestCase
package jp.group.android.atec.testter.logic; public class TwitterLogic { } package package jp.group.android.atec.testter.logic; public class TwitterLogicTest extends AndroidTestCase { } Class ”Test” JUnit TestCase 2011 5 26
14.
“test” +
+ public void testTwitterLogicAuthorization() { Authorization auth4test = ... TwitterLogic target = new TwitterLogic(auth4test); assertNotNull("Twitter ", target.twitter); } Assertion 2011 5 26
15.
assert() 2011
5 26
16.
2011
5 26
17.
Android Testing
Framework 2011 5 26
18.
Test Project 2011
5 26
19.
eclipse
package explorer New Test Project... 2011 5 26
20.
Dialog (1/2)
TestProject Project 2011 5 26
21.
Dialog (2/2)
package • • Class package 2011 5 26
22.
Why? 2011
5 26
23.
Android Testing Framework
/ 2011 5 26
24.
Android Testing Framework
/ 2011 5 26
25.
Android Testing Framework
/ • • Class package package 2011 5 26
26.
TestCase 2011
5 26
27.
Test Cases (1/2)
• AndroidTestCase • ApplicationTestCase • LoaderTestCase • ProviderTestCase2 • ServiceTestCase ※ JUnit TestCase 2011 5 26
28.
Test Cases (1/2)
• AndroidTestCase • ApplicationTestCase • LoaderTestCase Testter • ProviderTestCase2 • ServiceTestCase ※ JUnit TestCase 2011 5 26
29.
Test Cases (2/2)
• InstrumentationTestCase • ActivityTestCase • ActivityInstrumentationTestCase2 • ActivityUnitTestCase • SingleLaunchActivityTestCase • SyncBaseInstrumentation 2011 5 26
30.
AndroidTestCase 2011
5 26
31.
AndroidTestCase
• Activity • Context getContext() Context 2011 5 26
32.
public class PreferenceLogicTest
extends AndroidTestCase { public void testWriteReadToken() { PreferenceLogic logic = PreferenceLogic.getInstance(); logic.writeToken(getContext(), new AccessToken("11111", "22222")); AccessToken token = logic.readToken(getContext()); assertEquals("11111", token.getToken()); assertEquals("22222", token.getTokenSecret()); } } 2011 5 26
33.
ActivityInstrumentation
TestCase2 2011 5 26
34.
ActivityInstrumentation
TestCase2 • Activity • Activity • Context getContext() • ActivityInstrumentationTestCase @Deprecated 2011 5 26
35.
package jp.group.android.atec.testter; public class
AuthActivityTest extends ActivityInstrumentationTestCase2<AuthActivity> { protected void setUp() throws Exception { super.setUp(); setActivityInitialTouchMode(true); mIntent = new Intent(); setActivityIntent(mIntent); mActivity = getActivity(); mEditText = (EditText) mActivity.findViewById(R.id.pinEdit); mButton = (Button) mActivity.findViewById(R.id.registBtn); } 2011 5 26
36.
package jp.group.android.atec.testter; public class
AuthActivityTest extends ActivityInstrumentationTestCase2<AuthActivity> { protected void setUp() throws Exception { super.setUp(); setActivityInitialTouchMode(true); mIntent = new Intent(); Activity setActivityIntent(mIntent); mActivity = getActivity(); mEditText = (EditText) mActivity.findViewById(R.id.pinEdit); mButton = (Button) mActivity.findViewById(R.id.registBtn); } package res 2011 5 26
37.
public void testRegistBtnText()
{ // assertTrue(mButton.getText().toString() .equalsIgnoreCase(" ")); } Assertion 2011 5 26
38.
※
UI public void testClickButton() { mActivity.runOnUiThread(new Runnable() { public void run() { try { mButton.performClick(); assertXxx(...); } catch (RuntimeException e) { assertXxx(...); } } }); } 2011 5 26
39.
private 2011
5 26
40.
private
private final PreferenceLogic preferenceLogic = PreferenceLogic.getInstance(); private Drawable getCacheDrawable(URL url) { (snip) } 2011 5 26
41.
Class<AuthActivity> clazz =
AuthActivity.class; Field field = clazz .getDeclaredField("preferenceLogic"); Method method = getClass() .getMethod("getCacheDrawable"); method.invoke(); 2011 5 26
42.
CV 2011
5 26
43.
Fragile Test
private final PreferenceLogic preferenceLogic = PreferenceLogic.getInstance(); private Drawable getCacheDrawable(URL url) { (snip) } default Package Private 2011 5 26
44.
※
Class<View> clazz = View.class; Field field = clazz.getDeclaredField("mOnClickListener"); field.setAccessible(true); assertTrue(field.get(mButton) != null); AndroidSDK Class field → Mock 2011 5 26
45.
2011
5 26
46.
public AccessToken auth(String
pin) { AccessToken accessToken = null; try { (snip) } catch (TwitterException e) { (snip) throw new RuntimeException(e); } return accessToken; } == 2011 5 26
47.
fail
try { target.auth(null); fail("Twitter#getOAuthAccessToken() "); } catch (RuntimeException e) { assertEquals("catch ", expected, e.getCause()); } 2011 5 26
48.
Android Mock 2011
5 26
49.
Android Mock
• Dalvk EasyMock • Mock Class 2011 5 26
50.
public AccessToken auth(String
pin) { AccessToken accessToken = null; try { if (pin == null || "".equals(pin.trim())) { accessToken = twitter.getOAuthAccessToken(); } else { (snip) } } catch (TwitterException e) { (snip) } Twitter4J (snip) } 2011 5 26
51.
1/2 @UsesMocks(Twitter.class) public
void testAuth_ _PIN null() { // setup mock AccessToken expectedToken = new AccessToken("testToken", "testSecret"); Twitter Mock Twitter twitterMock = AndroidMock.createMock(Twitter.class); AndroidMock.expect(twitterMock .getOAuthAccessToken()).andReturn(expectedToken); AndroidMock.replay(twitterMock); 2011 5 26
52.
2/2
// setup test target TwitterLogic target = new TwitterLogic(); target.twitter = twitterMock; Mock // do test. AccessToken actual = target.auth(null); assertEquals(" AccessToken ", expectedToken, actual); // Mock AndroidMock.verify(twitterMock); } Mock 2011 5 26
53.
@UsesMocks(Twitter.class) public void
testAuth_ _ () { // setup mock TwitterException expected = new TwitterException("Unauthorized", null, 401); Twitter twitterMock = AndroidMock .createMock(Twitter.class); AndroidMock.expect(twitterMock .getOAuthAccessToken()).andThrow(expected); AndroidMock.replay(twitterMock); 2011 5 26
54.
http://www.slideshare.net/goyoki/an-approach-to-improving-the-maintainability-
of-unit-tests-xpjugkansai2011 2011 5 26
55.
• backlog
wiki • 2011 5 26
56.
2011.05.25 20:01 2011
5 26
Descargar ahora