ActivityInstrumentationTestCase2
を使用し、必要に応じてEspressoとUiAutomatorを使用することができます。
public class SampleActivityTests extends ActivityInstrumentationTestCase2<SampleActivity> {
private UiDevice mDevice;
public SampleActivityTests() {
super(SampleActivity.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
getActivity();
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
}
public void testAddNote() throws InterruptedException {
// Take a screenshot when app becomes visible.
onView(isRoot());
ScreenShotter.takeScreenshot("sample 1", getActivity());
mDevice.pressDPadLeft();
mDevice.pressDPadLeft();
ScreenShotter.takeScreenshot("sample 2", getActivity());
}
}
[OK]を私はこれを調べてあなたに戻って取得します、感謝 –
コードがコンパイルされ、働いて走った、そしてそれは、しかし、彼らは空/黒画面だった、私の2枚のスクリーンショットを取りました。テストビデオのステージでは画面が黒くなっていたので、私が使っているゲームのライブラリかもしれないと思っています。私はここからAndroidLauncherを使います(AndroidLauncher)(https://github.com/libgdx/libgdx/blob/9b8f20b2d0e96e53f0f2b98dc8f6131c810aae71/extensions/gdx-setup/src/com/badlogic/gdx/setup/resources/android/src/ AndroidLauncher)を使用しているため、動作すると思われましたが、 –