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

Tests project problem #5195


User avatar
0
BobIngham created

Hi guys, I ran all tests and almost all failed with the message "Message: Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Abp.Organizations.OrganizationUnitManager was found". It's a while since I ran tests so I'm not sure what's changed, I was fully expecting some to fail due to changes I have made to core Zero code but this seems to be an entirely different problem. Can anyone point me in the right direction? I am not fully conversant with how the Tests project is put together and in the past I have simply run it and then modified tests to reflect changes to core code and new tests for my own code. Can anyone point me in the right direction?


19 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Your *TestModule should indirectly depend on AbpZeroCommonModule. In ASP.NET Zero, *TestModule → *ApplicationModule → *CoreModuleAbpZeroCoreModuleAbpZeroCommonModule.

    Show the stack trace.

  • User Avatar
    0
    BobIngham created

    Hi Aaaron, Thanks for the help. From debugging:

    at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)\r\n   at Castle.MicroKernel.DefaultKernel.Resolve(Type service, IDictionary arguments)\r\n   at Castle.Windsor.WindsorContainer.Resolve[T]()\r\n   at Abp.Dependency.IocManager.Resolve[T]()\r\n   at Abp.Dependency.IocResolverExtensions.ResolveAsDisposable[T](IIocResolver iocResolver)\r\n   at Nuagecare.Migrations.Seed.Host.App.DefaultOrganizationUnitCreator.Create()\r\n   at Nuagecare.Migrations.Seed.Host.InitialHostDbBuilder.Create()\r\n   at Nuagecare.Migrations.Seed.SeedHelper.SeedHostDb(NuagecareDbContext context)\r\n   at Nuagecare.Migrations.Seed.SeedHelper.WithDbContext[TDbContext](IIocResolver iocResolver, Action`1 contextAction)\r\n   at Nuagecare.Migrations.Seed.SeedHelper.SeedHostDb(IIocResolver iocResolver)\r\n   at Nuagecare.EntityFrameworkCore.NuagecareEntityFrameworkCoreModule.PostInitialize()\r\n   at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module)\r\n   at System.Collections.Generic.List`1.ForEach(Action`1 action)\r\n   at Abp.Modules.AbpModuleManager.StartModules()\r\n   at Abp.AbpBootstrapper.Initialize()
    

    From the test explorer: [attachment=0:1d49vu01]TestProblem.PNG[/attachment:1d49vu01] Again, thanks for your help.

  • User Avatar
    0
    aaron created
    Support Team

    Check that your modules DependsOn those I mentioned.

  • User Avatar
    0
    BobIngham created

    Hi Aaron, this is traight from 5.4.1 download:

    namespace Nuagecare.Tests
    {
        [DependsOn(
            typeof(NuagecareApplicationModule),
            typeof(NuagecareEntityFrameworkCoreModule),
            typeof(AbpTestBaseModule))]
        public class NuagecareTestModule : AbpModule
        {
    
  • User Avatar
    0
    aaron created
    Support Team

    Do the tests in a fresh download work for you?

  • User Avatar
    0
    BobIngham created

    Hi Aaron, I confess to not having tried that. I am working on other stuff right now and because this is not critical I will come back to you after I finish my planned release and get back to you. Thanks for your help so far.

  • User Avatar
    0
    BobIngham created

    Hi Aaron,

    I'm having a go at this again. No matter how Icomment out the first two depends I seem to be getting problems. can you suggest a way forward?

    using Abp.Modules;
    using Abp.TestBase;
    using Abp.Zero;
    using Nuagecare.Test.Base;
    
    namespace Nuagecare.Tests
    {
        [DependsOn(typeof(NuagecareTestBaseModule),
            typeof(NuagecareTestModule),
            typeof(NuagecareApplicationModule),
            typeof(NuagecareCoreModule),
            typeof(AbpZeroCoreModule),
            typeof(AbpZeroCommonModule))]
        public class NuagecareTestModule : AbpModule
        {
           
        }
    }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @bobingham,

    NuagecareTestModule should only depend on NuagecareTestBaseModule and NuagecareTestBaseModule should depend on modules below:

    • NuagecareApplicationModule
    • NuagecareEntityFrameworkCoreModule
    • AbpTestBaseModule

    Could you check that on your project ?

  • User Avatar
    0
    BobIngham created

    @ismcagdas, thanks. I now have:

    [DependsOn(typeof(NuagecareTestBaseModule))]
        public class NuagecareTestModule : AbpModule
        {
           
        }
    

    and

    [DependsOn(
        typeof(NuagecareApplicationModule),
        typeof(NuagecareEntityFrameworkCoreModule),
        typeof(AbpTestBaseModule))]
    public class NuagecareTestBaseModule : AbpModule
    

    But I'm getting the following error. I have googled the forum and the github pages but not found this specific error. It may well be a result of a the merge from 5.4.1 to 6.8.0.

    Message: System.TypeInitializationException : The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception.
    ---- System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
    -------- System.DllNotFoundException : Unable to load DLL 'e_sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    
  • User Avatar
    0
    maliming created
    Support Team

    @bobingham

    Set up your project PlatformTarget to x86 example:

  • User Avatar
    0
    BobIngham created

    Thanks @maliming, I now have x86 for both the_ Tests_ and_ Test.Base_ projects. The error is now:

    Message: Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Abp.Organizations.OrganizationUnitManager was found
    

    I'm sure we're getting close!

  • User Avatar
    0
    maliming created
    Support Team

    @bobingham

    I think we are back to the origin. Can you send your project code to my mailbox? [email protected]

  • User Avatar
    0
    BobIngham created

    The two test projects?

  • User Avatar
    0
    maliming created
    Support Team

    Please send the full project, I need to test it locally.

  • User Avatar
    0
    BobIngham created

    Hi @maliming, I will just have to run without the test project. Thanks for your help. I have not yet implemented Azure Key Vault and there is too much sensitive information hanging around to pass you the entire project. In addition the project requires a local Mongodb (for audit trails and entity changes) and we also use Azure for files, blobs and simple tables. Setting up the system is not as simple as Zero's instructions. Again, thanks for your help. I may come back to this later but for now there are higher priorities.

  • User Avatar
    0
    maliming created
    Support Team

    You can also download Zero's Demo project to compare the code and dependencies between modules to confirm your problem.

  • User Avatar
    0
    BobIngham created

    Yep, that's an option I will take up later tonight when time permits. Again, thanks for your help and suggestions, always a pleasure.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Just to remind you, this issue has been fixed.

  • User Avatar
    0
    SelfSwapAdmin created

    What do you mean this has been fixed? How? Where? I am getting this same error trying to build a console app.