Presentation android JUnit
-
Upload
enrique-manas -
Category
Technology
-
view
1.298 -
download
2
description
Transcript of Presentation android JUnit
Testing AndroidEnrique López Mañas
Unit Testing What is unit testing?
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.
http://en.wikipedia.org/wiki/JUnit
Using JUnit
Using JUnit
Running
Results
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 = Exception.class)
Fails if not exception
@Test(timeout=100) Fails if timeout
AssertionsAssertion Description
fail(string) Fails with message
assertTrue([message], boolean condition)
Asserts if true
assertsEquals([String message], expected, actual)
Asserts if equal
assertNull([message], object)
Asserts if object is null
assertNotNull([message], object)
Asserts if object is not null
Android Testing Activity Testing Content Provider Testing Service Testing
Next… Testing tools Maven Continuous Integration
Links http://www.junit.org/
http://www.neo-tech.es
http://developer.android.com/tools/testing/testing_android.html