我如何编写使用内置的摄像头进行拍照独奏/ Robotium测试用例?独奏、摄像头、测试、Robotium

2023-09-06 06:10:29 作者:申请住进你心里

从我的活动我做startActivityForResult(MediaStore.ACTION_IM​​AGE_CAPTURE),结果然后我土地的内置摄像头的活动(在这种情况下,在模拟器)。

From my activity I do startActivityForResult(MediaStore.ACTION_IMAGE_CAPTURE), and then I land in the builtin camera activity (in this case in the emulator).

当我现在要做的:结果solo.clickOnButton(0);搜索在我的测试用例,它没有找到任何按钮(null被发现指数= 0)。

When I now do: "solo.clickOnButton(0);" in my testcase, it does not find ANY button (null is found for index=0).

我如何编写使用内置的摄像头进行拍照独奏/ Robotium测试用例?

How do I write a Solo/Robotium testcase that uses the builtin camera to take a picture ?

推荐答案

根据Robotium文档,你不能这样做,因为这跨越两个应用程序(你一个和默认的摄像头活动)。请参见 HTTP://$c$c.google.com/p/robotium/维基/ QuestionsAndAnswers

according to the Robotium doc you cannot do this as this spans two applications ( your one and the default camera activity ). See http://code.google.com/p/robotium/wiki/QuestionsAndAnswers

您要么需要你的包内编写自己的相机实现或写两个测试应用程序

You will either need to write your own camera implementation within your package or write two test applications

希望这有助于:)