Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Presentation android JUnit


Published on

Presentation on Android and JUnit

Published in: Technology, Education
  • Be the first to comment

Presentation android JUnit

  1. 1. TestingAndroidEnrique López Mañas
  2. 2. Unit Testing What is unit testing?
  3. 3. Unit Testing with JUnit JUnit 4.x is a test framework which uses annotations to identify methods that are test methods. JUnit assumes that all test methods can be executed in an arbitrary order. Therefore tests should not depend on other tests.
  4. 4. Using JUnit
  5. 5. Using JUnit
  6. 6. Running
  7. 7. Results
  8. 8. AnnotationsAnnotation Description@Test Test method@Before Execute before each test@After Execute after each test@BeforeClass Execute once before all tests@AfterClass Execute once after all tests@Ignore Ignore test@Test (expected = Fails if not exceptionException.class)@Test(timeout=100) Fails if timeout
  9. 9. AssertionsAssertion Descriptionfail(string) Fails with messageassertTrue([message], Asserts if trueboolean condition)assertsEquals([String Asserts if equalmessage], expected,actual)assertNull([message], Asserts if object is nullobject)assertNotNull([message], Asserts if object is not nullobject)
  10. 10. Android Testing ActivityTesting Content Provider Testing Service Testing
  11. 11. Next… Testing tools Maven Continuous Integration
  12. 12. Links g/testing_android.html