Hello,
I have been trying to unit test my ArcGIS Pro add-in in an automated fashion on a build server.
I followed the steps in this guide to get unit testing working on my local machine (which works great): https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Regression-Testing
However, I'm finding that because the user on the build server is not logged into an ArcGIS Portal, that this method in the above guide is failing:
/// <summary>
/// Starts an instance of ArcGIS Pro Application
/// </summary>
public static async void StartApplication()
{
var evt = new System.Threading.ManualResetEvent(false);
System.Threading.Tasks.Task ready = null;
var uiThread = new System.Threading.Thread(() =>
{
try
{
Application = new ProApp();
ready = Application.TestModeInitializeAsync();
evt.Set();
}
catch (XamlParseException)
{
throw new FatalArcGISException("Pro is not licensed");
}
catch (Exception ex)
{
throw ex;
}
finally
{
evt.Set();
}
System.Windows.Threading.Dispatcher.Run();
});
uiThread.TrySetApartmentState(System.Threading.ApartmentState.STA);
uiThread.Name = "Test UI Thread";
uiThread.IsBackground = true;
uiThread.Start();
evt.WaitOne(); // Task ready to wait on.
if (ready != null)
{
try
{
await ready;
}
catch (Exception ex)
{
throw ex;
}
}
}
The error message I see in the console from the test run says: The active test run was aborted. Reason: Test host process crashed
Is there a way to programmatically provide Portal credentials to the ArcGIS Pro application before it is initialized for unit testing?