开发者

SingleLaunchActivityTestCase cannot launch activity on test

I'm new in android testing. All I've used in the testing is only the ActivityInstrumentationTestCase2 (AITC2) which is explained in the Hello, Testing tutorial.

I've made a test class using AITC2 and it runs well. But once I changed the base test class to SingleLaunchActivityTestCase (SLATC) I got开发者_开发百科 RuntimeException specifying "Unable to resolve intent.. blabla.." which I suspect was originated from launchActivity().

I thought AITC2 and SLATC are pretty much the same, besides that in SLATC the activity being tested only launched once (setUp() only launched once for all test cases) and in AITC2 the activity will be launced for every test cases.

I've tried to find some example or documentation about how to use SLATC but still no luck.. :(.

Anybody knows why the activity cannot be launched in SLATC? Thanks in advance :)


Solved it. I put a wrong package string in the constructor because I have several different subpackages in my project.

I put [package].activity, it should be only [package].

Kind of weird answering my own question, but just in case someone looking for an answer from the same mistake as mine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜