1

Closed

TFS Test Build breaks with AutoMapper Exception

description

I have created a test cases for my application. All the test works fine when i run them locally. When i set up a build to run all the test every morning in TFS, i get this below error.

Error Message looks like this.

Class Initialization method RightsLine.Test.MockTest.CRUDCharacteristicTemplateTest.Setup threw exception. AutoMapper.AutoMapperConfigurationException: AutoMapper.AutoMapperConfigurationException:
The following property on System.Int32 cannot be mapped: <PROPERTY>
Add a custom mapping expression, ignore, add a custom resolver, or modify the destination type System.Int32.
Context:
Mapping to property <PROPERTY> from System.Byte to System.Int32
Mapping from type <CLASS_A> to <CLASS_B>
Exception of type 'AutoMapper.AutoMapperConfigurationException' was thrown..enter code here
Error Stack Trace looks like this.

AutoMapper.ConfigurationStore.DryRunTypeMap(ICollection1 typeMapsChecked, ResolutionContext context)
AutoMapper.ConfigurationStore.DryRunTypeMap(ICollection
1 typeMapsChecked, ResolutionContext context)
AutoMapper.ConfigurationStore.AssertConfigurationIsValid(IEnumerable`1 typeMaps)
AutoMapper.ConfigurationStore.AssertConfigurationIsValid()
AutoMapper.Mapper.AssertConfigurationIsValid()
Why this DryRunTypeMap is throwing error when it runs the test build but not when i do it from local. Any help would be appreciated.

Thanks.
Closed Jul 30, 2015 at 1:04 PM by jbogard
The project has moved to GitHub.

comments

Inzenet wrote Nov 5, 2014 at 8:51 AM

Hello,

same problem here (on TeamCity).
have you found a solution ?

Cheers,

Luc

vcpatel wrote Nov 6, 2014 at 4:52 PM

Nope, haven't found a solution.

Inzenet wrote Nov 6, 2014 at 6:32 PM

We have one (thanks to my collegue Geoffrey for finding it)

If you have a unit test that fails because of AutoMapper’s AssertConfigurationIsValid in TeamCity (on the build step that uses MSTest) but doesn’t fail in Visual Studio Test Runner :
  • Make sure the AutoMapper nugget package is installer on the test project
  • Add this attribute on the TestClass : [DeploymentItem("AutoMapper.Net4.dll")]
here you are :) (hope this work for you)

vcpatel wrote Nov 6, 2014 at 7:17 PM

This does not fix for TFS Build.

wrote Jul 30, 2015 at 1:04 PM