We are currently creating an app that runs on Android 2.1-2.3.3 and Android 3.1 (honeycomb). The automated tests are running on both phone and tablet emulators.
It is difficult to manage which tests run on the phone vs the tablet.
Currently, some of our test look like this:
public void testSomething() {
public void testSomething() {
if(isTablet){
//run tablet test
} else {
//run phone test
}
}
Is there a better way to manage what devices the tests run on? Some of the app screens on the tablet differ from the phone and need those if statements. Other pages share the same screen and do not need dedicated tests. Is there a way to exclude specific test classes from a test run (tablet or phone).
Any 开发者_Python百科help is appreciated.
Thanks!
I think you shouldn't check for tablet or else but base your app on screen size and SDK version.
This reading maybe interesting to you.
If your app supports both tablet and regular android, then why not take advantage of Android Multiple APK Support:
With multiple APK support, you can now upload multiple versions of an APK for a single product listing, with each one addressing a different subset of your customers. These APKs are complete, independent APKs that share the same package name, but contain code and resources to target different Android platform versions, screen sizes, or GL texture-compression formats.
This way, you can have two different test projects, one for each application.
精彩评论