Intel Information Technology
Testando sua App na Nuvem
Eduardo Carrara
Developer Evangelist – Intel Developers Relations Division
#IntelAndroidBR
2
Intel Information Technology 3
Intel Information Technology 4
“Testers don’t break software,
software is already broken”
– Amir Ghahrai
Intel Information Technology 5
Sprint 1
• 5 Stories
• 1 Test Plan per Story
• 1 Hour per Test Plan
• 5h of Testing
Sprint 2
• +5 Stories
• +1 Test Plan per Story
• 1 Hour per Test Plan
• 5h of testing + 5h of regression test
Sprint 3
• +5 Stories
• +1 Test Plan per Story
• 1 Hour per Test Plan
• 5h of testing + 10h of regression test
Intel Information Technology 6
Intel Information Technology
“I choose a lazy person to do a hard job. Because a lazy
person will find an easy way to do it.”
- Bill Gates
7
Image by Karla Vidal @ http://www.flickr.com/photos/63721650@N00/3661526274
Creative Commons cc-by-2.0
Intel Information Technology 8
JUnit
Intel Information Technology 9
public static String getFormattedMonthDay(String format, String dateString) {
String finalDateString = "";
SimpleDateFormat dbDateFormat = new SimpleDateFormat(Utility.DATE_FORMAT);
try {
Date inputDate = dbDateFormat.parse(dateString);
SimpleDateFormat requestedDateFormat = new SimpleDateFormat(format);
finalDateString = requestedDateFormat.format(inputDate);
} catch (ParseException e) {
e.printStackTrace();
} catch (NullPointerException npex) {
npex.printStackTrace();
}
return finalDateString;
}
Intel Information Technology 10
public void testGetFormattedMonthDayForBadInput() throws Exception {
String inputDateString = "";
final String expectedDateFormat = "yyyy, MMMM dd";
final String expectedResult = "";
String result = Utility.getFormattedMonthDay(expectedDateFormat,
inputDateString);
assertEquals("A wrong formatted input must return an empty String",
expectedResult, result);
}
public class UtilityTest extends TestCase {
…
…
}
Intel Information Technology 11
Image by Schlurcher @ http://en.wikipedia.org/wiki/Jigsaw_puzzle#/media/File:Puzzle_Krypt-2.jpg
Creative Commons cc-by-sa-2.0
It's hard enough to find an error in your code when you're looking for it; it's even harder
when you've assumed your code is error-free.
--Steve McConnell (from Code Complete)
Intel Information Technology 12
JUnit
Intel Information Technology
Android Testing Framework
13
• Special TestCases, Asserts e Mocks
• MoreAsserts
• ViewAsserts
• MockApplication
• MockContext
• MockContentProvider
• AndroidTestCase
• ActivityInstrumentationTestCase2
• ActivityUnitTestCase
• ApplicationTestCase
• InstrumentationTestCase
• ProviderTestCase
• ServiceTestCase
• SingleLaunchActivityTestCase
JUnit
Intel Information Technology
Instrumentation
14
• Android Components Context Access;
• Components Lifecycle Control;
• Component Loading Control;
• System Events (e.g.: Broadcasts)
• InstrumentationTestRunner
• AndroidJUnitRunner
• GoogleInstrumentationTestRunner
Intel Information Technology
Expresso
15
• Simplifies the UI Test Process within
your App
• Methods for:
• View matching
• Checks
• UI Events
Intel Information Technology
Fragmentação
16
“If you don’t like testing your product, most likely your customers won’t like to
test it either.”
- Anonymous
Intel Information Technology 17
Intel Information Technology 18
Intel Information Technology 19
Intel Information Technology 20
Intel Information Technology 21
Intel Information Technology
What is next?
22
• What about cross app testing? UIAutomator!
• Continuous Delivery and Integration of Android Apps
• Code Coverage
Intel Information Technology
Intel Developer Zone
23
https://software.intel.com/en-us/android/app-testing
Intel Information Technology
Thanks!
24
+EduardoCarraraDeAraujo
https://www.facebook.com/ducarrara
@DuCarrara
br.linkedin.com/in/eduardocarrara/
Intel Information Technology
References
25
• Android Testing: https://developer.android.com/tools/testing/testing_android.html
• Android Unit Testing Support: http://tools.android.com/tech-docs/unit-testing-support
• UI Testing: https://developer.android.com/training/testing/ui-testing/index.html
• Android Testing Support Library: https://developer.android.com/tools/testing-support-
library
• Android Instrumentation:
http://developer.android.com/tools/testing/testing_android.html#Instrumentation
• Junit: http://junit.org
• Testdroid: http://testdroid.com
• Intel App Testing Page: https://software.intel.com/en-us/android/app-testing
Testing Your App in the Cloud

Testing Your App in the Cloud

  • 1.
    Intel Information Technology Testandosua App na Nuvem Eduardo Carrara Developer Evangelist – Intel Developers Relations Division
  • 2.
  • 3.
  • 4.
    Intel Information Technology4 “Testers don’t break software, software is already broken” – Amir Ghahrai
  • 5.
    Intel Information Technology5 Sprint 1 • 5 Stories • 1 Test Plan per Story • 1 Hour per Test Plan • 5h of Testing Sprint 2 • +5 Stories • +1 Test Plan per Story • 1 Hour per Test Plan • 5h of testing + 5h of regression test Sprint 3 • +5 Stories • +1 Test Plan per Story • 1 Hour per Test Plan • 5h of testing + 10h of regression test
  • 6.
  • 7.
    Intel Information Technology “Ichoose a lazy person to do a hard job. Because a lazy person will find an easy way to do it.” - Bill Gates 7 Image by Karla Vidal @ http://www.flickr.com/photos/63721650@N00/3661526274 Creative Commons cc-by-2.0
  • 8.
  • 9.
    Intel Information Technology9 public static String getFormattedMonthDay(String format, String dateString) { String finalDateString = ""; SimpleDateFormat dbDateFormat = new SimpleDateFormat(Utility.DATE_FORMAT); try { Date inputDate = dbDateFormat.parse(dateString); SimpleDateFormat requestedDateFormat = new SimpleDateFormat(format); finalDateString = requestedDateFormat.format(inputDate); } catch (ParseException e) { e.printStackTrace(); } catch (NullPointerException npex) { npex.printStackTrace(); } return finalDateString; }
  • 10.
    Intel Information Technology10 public void testGetFormattedMonthDayForBadInput() throws Exception { String inputDateString = ""; final String expectedDateFormat = "yyyy, MMMM dd"; final String expectedResult = ""; String result = Utility.getFormattedMonthDay(expectedDateFormat, inputDateString); assertEquals("A wrong formatted input must return an empty String", expectedResult, result); } public class UtilityTest extends TestCase { … … }
  • 11.
    Intel Information Technology11 Image by Schlurcher @ http://en.wikipedia.org/wiki/Jigsaw_puzzle#/media/File:Puzzle_Krypt-2.jpg Creative Commons cc-by-sa-2.0 It's hard enough to find an error in your code when you're looking for it; it's even harder when you've assumed your code is error-free. --Steve McConnell (from Code Complete)
  • 12.
  • 13.
    Intel Information Technology AndroidTesting Framework 13 • Special TestCases, Asserts e Mocks • MoreAsserts • ViewAsserts • MockApplication • MockContext • MockContentProvider • AndroidTestCase • ActivityInstrumentationTestCase2 • ActivityUnitTestCase • ApplicationTestCase • InstrumentationTestCase • ProviderTestCase • ServiceTestCase • SingleLaunchActivityTestCase JUnit
  • 14.
    Intel Information Technology Instrumentation 14 •Android Components Context Access; • Components Lifecycle Control; • Component Loading Control; • System Events (e.g.: Broadcasts) • InstrumentationTestRunner • AndroidJUnitRunner • GoogleInstrumentationTestRunner
  • 15.
    Intel Information Technology Expresso 15 •Simplifies the UI Test Process within your App • Methods for: • View matching • Checks • UI Events
  • 16.
    Intel Information Technology Fragmentação 16 “Ifyou don’t like testing your product, most likely your customers won’t like to test it either.” - Anonymous
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
    Intel Information Technology Whatis next? 22 • What about cross app testing? UIAutomator! • Continuous Delivery and Integration of Android Apps • Code Coverage
  • 23.
    Intel Information Technology IntelDeveloper Zone 23 https://software.intel.com/en-us/android/app-testing
  • 24.
  • 25.
    Intel Information Technology References 25 •Android Testing: https://developer.android.com/tools/testing/testing_android.html • Android Unit Testing Support: http://tools.android.com/tech-docs/unit-testing-support • UI Testing: https://developer.android.com/training/testing/ui-testing/index.html • Android Testing Support Library: https://developer.android.com/tools/testing-support- library • Android Instrumentation: http://developer.android.com/tools/testing/testing_android.html#Instrumentation • Junit: http://junit.org • Testdroid: http://testdroid.com • Intel App Testing Page: https://software.intel.com/en-us/android/app-testing