Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Default tests not working #1666


User avatar
0
hozkar created

I'm trying to add testing to my project but when I run the default unit tests (from Zero) I got the following error in all of the tests related to application services:

Test Name: Bow.Tests.Organizations.OrganizationUnitAppService_Tests.Test_CreateOrganizationUnit Test FullName: Bow.Tests.Organizations.OrganizationUnitAppService_Tests.Test_CreateOrganizationUnit Test Source: C:\Users\Darwin\Source\Repos\BowZero\Tests\Bow.Tests\Organizations\OrganizationUnitAppService_Tests.cs : line 53 Test Outcome: Failed Test Duration: 0:00:00,001

Result StackTrace: en Abp.AutoMapper.AbpAutoMapperModule.FindAndAutoMapTypes(IMapperConfigurationExpression configuration) en Abp.AutoMapper.AbpAutoMapperModule.<CreateMappings>b__6_0(IMapperConfigurationExpression configuration) en D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AbpAutoMapperModule.cs:línea 55 en AutoMapper.MapperConfiguration.Build(Action1 configure) en AutoMapper.Mapper.Initialize(Action1 config) en Abp.AutoMapper.AbpAutoMapperModule.CreateMappings() en D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AbpAutoMapperModule.cs:línea 53 en Abp.AutoMapper.AbpAutoMapperModule.PostInitialize() en D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AbpAutoMapperModule.cs:línea 36 en Abp.Modules.AbpModuleManager.<>c.<StartModules>b__16_2(AbpModuleInfo module) en D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:línea 49 en System.Collections.Generic.List1.ForEach(Action1 action) en Abp.Modules.AbpModuleManager.StartModules() en D:\Halil\GitHub\aspnetboilerplate\src\Abp\Modules\AbpModuleManager.cs:línea 49 en Abp.AbpBootstrapper.Initialize() en D:\Halil\GitHub\aspnetboilerplate\src\Abp\AbpBootstrapper.cs:línea 138 en Abp.TestBase.AbpIntegratedTestBase1.InitializeAbp() en D:\Halil\GitHub\aspnetboilerplate\src\Abp.TestBase\TestBase\AbpIntegratedTestBase.cs:línea 42 en Abp.TestBase.AbpIntegratedTestBase1..ctor(Boolean initializeAbp) en D:\Halil\GitHub\aspnetboilerplate\src\Abp.TestBase\TestBase\AbpIntegratedTestBase.cs:línea 34 en Bow.Tests.AppTestBase..ctor() en C:\Users\Darwin\Source\Repos\BowZero\Tests\Bow.Tests\AppTestBase.cs:línea 36 en Bow.Tests.Organizations.OrganizationUnitAppService_Tests..ctor() en C:\Users\Darwin\Source\Repos\BowZero\Tests\Bow.Tests\Organizations\OrganizationUnitAppService_Tests.cs:línea 19 Result Message: System.MissingMethodException : Método no encontrado: 'Castle.Core.Logging.ILogger Abp.Modules.AbpModule.get_Logger()'.


4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Which Abp version are you using* It seems not all Abp.* packages are updated in all your projects. Even if they are updated, there may be some old dlls (try to delete all bin & obj folders in your solution and re-build it). Because your exception says AbpModule class has not a Logger property, but it's there (<a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/Modules/AbpModule.cs#L35">https://github.com/aspnetboilerplate/as ... ule.cs#L35</a>).

  • User Avatar
    0
    hozkar created

    Good day, hikalkan

    Thanks for your quick answer. I'm using v0.11.0.2.

    I did as you said but the failing tests persists. I think the problem is that the Logger dependency is not being injected into the tests classes because other tests that aren't related to the application services run successfully (ConnectionString and PasswordComplexity). The solution runs normally as well.

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Actually, problem is not that Logger is not injected, the problem is runtime can not find AbpModule class's Logger property at all, and this is only possible your test code "somehow" runs an old version of Abp.dll. Can you go to the output folder of test project (bin\Debug for Debug mode) and right click to Abp.dll and see Details to check version number?

  • User Avatar
    0
    hozkar created

    Good day hikalkan,

    You are right, solution projects were in v0.11.0.2. but test project was in v0.10.3.1. I updated it and they all passed.

    Thanks a lot for your quick and accurate answer.