b7c67dbac6416e6b3f9296abd4b6bf9e840a8acc |
|
27-Mar-2013 |
Flavio Lerda <flerda@google.com> |
Fix class runner selection. Currently, we use the AndroidJUnit4ClassRunner only for classes that declare fields annotated with InjectInstrumentation or InjectContext. However, this check does not take into consideration that base classes (that might be used to implement shared test fixtures) might also want to use these annotations and therefore we need to check all fields. The logic is correctly implemented in the AndroidJUnit4ClassRunner (by means of using org.junit.runners.model.TestClass), i.e., all fields from super classes are considered; however this test runner will not be used if one of the parent classes declares the inject field but the class defining the tests does not. This commit fixes this issue by traversing the class hierarchy as done by the TestClass implementation. Change-Id: I31e4e2f251e5bb79eedd43f59a6ba63368dcd9a2
/frameworks/testing/androidtestlib/tests/src/com/android/test/InstrumentationJUnit4Fixture.java
|