Skip to main content
Solved

Unit Tests are failing after upgrade to 2022R1 - 22.103.0018


jedmunds36
Jr Varsity III
Forum|alt.badge.img

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()

 

Best answer by jedmunds36

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
    {

View original
Did this topic help you find an answer to your question?

6 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • May 4, 2022

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

 

 


jedmunds36
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 21 replies
  • May 4, 2022

Thanks, Naveen.

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

john


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3407 replies
  • May 4, 2022

Hi, @jedmunds36  Thanks for the update.

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


jedmunds36
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 21 replies
  • May 4, 2022

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[[PX.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.GetInstance[TService]()
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.CreateInstance[Graph]() line 112
InventoryItemMaintExtTests.PrepareGraph() line 24


jedmunds36
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 21 replies
  • Answer
  • May 4, 2022

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
    {


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2754 replies
  • May 4, 2022

Thank you for sharing your solution @jedmunds36 !


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings