Reputation: 9
According to the Xamarin UI Test documentation I need to do this:
IApp app = ConfigureApp.Android
.DeviceSerial("0756edf000620ace")
.ApkFile(PathToAPK)
.StartApp();
But it seems odd to me to have the DeviceSerial and the ApkFile hard coded like this. Additionally, when submitting to appcenter.ms those two settings aren't required. It seems to me that there must be some way to externalize this information so that you can run the same test on multiple devices without having to go in and change the code.
Sure, I could use some other external external resource but what I really want is to be able to specify these values at run time without recompiling
Upvotes: 1
Views: 517
Reputation: 76
Try something like this in AppInitializer class for the UiTest project:
public static IApp StartApp(Platform platform)
{
if (platform == Platform.Android)
{
return ConfigureApp
.Android
.InstalledApp(package_name)
.StartApp();
}
else
{
return ConfigureApp
.iOS
.InstalledApp(package_name)
.StartApp();
}
}
where package_name is the name of your application package. You can get it from android manifest under the name package
Upvotes: 0
Reputation: 126
I think you don't need to specify "DeviceSerial". Try launch the test only with:
IApp app = ConfigureApp.Android
.ApkFile(PathToAPK)
.StartApp();
Upvotes: 1