ActivityInstrumentationTestCase2ではまったこと。
評価用のデータを以下のように作っておいたのだが、2つ目以降のテストで NullPointerExceptionが出る現象が。
public class HogeTest extends ActivityInstrumentationTestCase2<MainActivity> { private static final String[] TEST_NAMES = {"A", "B", "C", "D", "E"}; private static final String[] TEST_URLS = {"http://a.com/", "http://b.com/", "http://c.com/", "http://d.com/", "http://e.com/"}; ...
これに対する回答が
> The reason is scrubClass() method called from super.tearDown(): google-groups discussion. A solution is - overriding this method.
となっているが、他に影響もでそうなのでsetUp時に初期化することで回避した。
なんでこんなことになっているのか理由がよく分からない。