I am testing my Android application using ActivityInstrumentationTestCase2, and I need to test that the screen orientation change works correctly. However, I cannot find any way to cause an orientation to occur. What am I missing?
I am testing my Android application using ActivityInstrumentationTestCase2, and I need to test that
Share
Check this example where I tried extending Android ActivityInstrumentationTestsCase2 to use different screen orientations: iliasbartolini / AgileDayConferenceApp
Basically you need to change the Resources configuration. I found this example here: Tip for unit-testing: loading Resources for a specific screen orientation/
Here is a dummy Landscape test example on how to use it.
It actually only checks that the Landscape layout and resources loaded by the activity are not broken: don’t know if there are better ways to do it.
And here the Portrait test