Skip to main content

I am getting an error on my unit tests after upgrade to 22R1, specifically as shown below:

Am I missing an updated PX.Tests.Unit DLL or other ?

 

  Message:
System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task PX.Licensing.IApiLicensePolicy.ApplyRequestThrottling()'.

  Stack Trace:
TestBase.RegisterServices(ContainerBuilder builder)
LifetimeScope.CreateScopeRestrictedRegistry(Object tag, Action`1 configurationAction)
LifetimeScope.BeginLifetimeScope(Object tag, Action`1 configurationAction)
LifetimeScopeHelper.BeginLifetimeScope(ISlotStore slots, Object tag, Action`1 configurationAction) line 39
TestBase.ctor()

 

Hi @jedmunds36  Not sure about this issue, but I think this issue can be fixed by performing below steps.

  • Open Acumatica Configuration Wizard
  • Click on Perform Application Maintenance
  • Select the instance and click on the Upgrade → Upgrade only website

 

 


Thanks, Naveen.

Unfortunately, re-running ERP config tool for Upgrade only website did not overcome the error.

john


Hi, @jedmunds36  Thanks for the update.

Hope you will get a faster response from Acumatica if you raise a support case.


I updated PX.Tests.Unit from the C:\Program Files\AcumaticaERP\UnitTesting folder
and from the AcumaticaUnitTestDemo on GitHub, it became clear I was missing
Microsoft.Bcl.AsyncInterfaces from Nuget.

Some of my Unit Tests work, such as SalesOrderTests, but my InventoryItemTests
fail with the following details:

Message: 
CommonServiceLocator.ActivationException : Activation error occurred while trying to get instance of type Func`2, key ""
---- Autofac.Core.Registration.ComponentNotRegisteredException : The requested service 'System.Func`2`2PX.Data.PXGraph, PX.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3b136cac2f602b8e],]PX.Objects.CM.Extensions.IPXCurrencyService, PX.Objects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.

Stack Trace: 
ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
ServiceLocatorImplBase.GetInstanceaTService]()
PXDBCurrencyPriceCostAttribute._ensurePrecision(PXCache sender, Object row) line 35
PXDBCurrencyPriceCostAttribute.CacheAttached(PXCache sender) line 31
PXEventSubscriberAttribute.InvokeCacheAttached(PXCache cache) line 222
PXCache`1.ctor(PXGraph graph) line 3446
PXCacheCollection.get_Item(Type key) line 669
PXView.ctor(PXGraph graph, Boolean isReadOnly, BqlCommand select) line 1185
PXSelectBase`2.ctor(PXGraph graph) line 1611
View.ctor(PXGraph graph) line 37
InventoryItemMaintBase.ctor() line 37
InventoryItemMaint.ctor() line 115
PXGraph.CreateInstance(Type graphType, String prefix) line 261
PXGraph.CreateInstancepGraph]() line 112
InventoryItemMaintExtTests.PrepareGraph() line 24


Success!

My class file was inheriting TestBase and not UnitTestWithGLSetup, hence the lack of the service registration…

from:

    public class InventoryItemMaintExtTests : TestBase
    {

to:

    public class InventoryItemMaintExtTests : UnitTestWithGLSetup
    {


Thank you for sharing your solution @jedmunds36 !


Reply