I am trying to set up some unit tests for an add-in I am working on. I have followed the Esri Documentation to a T and everything compiles totally fine. The problem seems to lie in ClassInitialize function provided in the guide where it calls Project.OpenAsync(@"{insert project path here}").
When I run my unit tests they always fail at this line and the error says that it is unable to open the project. I am certain that there is a valid project at the path I am giving it. Pro will open the project just fine if I open the project from within pro. The even stranger thing is, if I debug and manually walk through the unit tests as they are executing, the error doesn't happen and the tests pass. But only when I am using the debugger. If I run them normally they will fail every time.
Has anyone else encountered a similar issue while unit testing? I can't seem to find much on this and the things I have tried, have not worked.
Solved! Go to Solution.
Hi @UmaHarano ,
Thank you for responding. Yes it does, but I did end up resolving the issue. I had thought my named user license was authorized for offline work and turns out it was not (my organization had it disabled globally). So, by correcting that I was able to resolve the issue. I wasn't sure how to mark this as solved.
Hi @JoePolaski
Does your unit test code for OpenAsync look similar to this?
// Open existing project
Project project = null;
try
{
project = await Project.OpenAsync("project path");
}
catch (Exception ex)
{
// exception
}
Hi @UmaHarano ,
Thank you for responding. Yes it does, but I did end up resolving the issue. I had thought my named user license was authorized for offline work and turns out it was not (my organization had it disabled globally). So, by correcting that I was able to resolve the issue. I wasn't sure how to mark this as solved.