Reputation: 18799
I am trying to develop Xamarin.UiTests
using this: "Introduction to Xamarin UITests which says my setup code needs to look like this:
[SetUp]
public void Setup()
{
app = ConfigureApp.Android.AppBundle("/path/to/application.apk").StartApp();
}
Previously I used to used to right click my project and press "Publish .apk file" which would create me a file to use. A similar technique is talked about here: http://www.sweet-web-design.com/wordpress/how-to-build-your-android-app-for-testing-in-visual-studio/2581/
But now Xamarin have introduced something called "Archiving" which is talked about here: https://developer.xamarin.com/releases/vs/xamarin.vs_4/xamarin.vs_4.2/#publishing
Which states:
The new Archive command replaces the old Build > Export Android Package (.apk) and Tools > Android > Publish Android App commands.
The archive button gives me an error which I cannot actually read all of (no matter how big I make the window) see below:
So is there a way I can create an .apk file using visual studio, preferably without the "Archive" feature (as creating a seperate package version while developing ui tests seems like a waste of time, plus doesn't actually work)
Upvotes: 5
Views: 2601
Reputation: 76
If you have your application installed on your android device, you can use something like this:
[SetUp]
public void BeforeEachTest()
{
app = ConfigureApp.Android.InstalledApp("package_name").StartApp();
}
where "package_name" is the name of your package. You can get it from android manifest under the name package
Upvotes: 2
Reputation: 47937
If you associate the UITest project with your Android project then the .apk should be generated automatically when you build the UITest project.
From the Xamarin documentation:
The next step is to establish the association between the UITest project and the mobile apps. Right click on the References folder in the UITest project and select Add References... from the context menu. Select the mobile app projects from the Reference Manager dialog that appears.
When this is done you should not need to specify the path to the app bundle in your UITest. The .apk path should be determined by Xamarin.UITest since the project is referenced.
Upvotes: 0