Any Suggestion On Setting Up Unit Test Project to Test ArcPro AddIn Library

180
2
Jump to solution
2 weeks ago
Gurunara
New Contributor III

How to set up Unit Test Project to test a ArcPro AddIn project? MsTest is also fine. Also would like to integrate Moq.

So far:
Added an NUnit test project to the solution and referenced the addin project. Wouldn't compile so opened the test project csproj file and changed 

<TargetFramework>net6.0</TargetFramework> to
<TargetFramework>net6.0-windows</TargetFramework>

Now it compiles, but when running a unit test, get the following error:

System.IO.FileNotFoundException : Could not load file or assembly 'ArcGIS.Desktop.Framework, Version=13.2.0.0, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86'. The system cannot find the file specified.

Both the addin project and the test project have <PlatformTarget>x64</PlatformTarget>.

Is this a license issue? Have Named User License.



Tags (1)
0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

Esri recommends MSTest type project for unit testing. Have you looked at Regression testing documentation?

I would recommend delete all ArcGIS Pro references from test project and add Esri.ArcGISPro.Extensions30 package instead.

Some interesting stuff you can found here.

View solution in original post

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Esri recommends MSTest type project for unit testing. Have you looked at Regression testing documentation?

I would recommend delete all ArcGIS Pro references from test project and add Esri.ArcGISPro.Extensions30 package instead.

Some interesting stuff you can found here.

0 Kudos
Gurunara
New Contributor III

Above post referring to the guide Regression testing documentation
worked for me. However, these things had to be changed for me (working with vs2022 community edition.)

Do not delete/replace in the test project's *.csproj file, the entry:
<RootNamespace>...</RootNamespace>
(This will prevent the project from compiling...)

Also do not copy over:
<Platforms>x64</Platforms>
<PlatformTarget>x64</PlatformTarget>
to your test project *.csproj file.

This prevented the tests from running.

Other parts of the guide can be followed...


0 Kudos