Open Closed

ABP generated module sample test case getting repository null #8160


User avatar
0
Karunakar created
  • ABP Framework version: latest
  • UI Type: Angular
  • Database System: EF Core (MySQL.)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:Plesae provide a sample project that having sample test case to check the appservice with sample data
  • Steps to reproduce the issue: *Create a module using ABP studio that module can also contain test project. *Write a test case to check the Appservice present in application project. *Write test case with using test Data that need to verify weather the service is working fine or not. *Repository needs to show the nserted test records. *After redirected to AppService while debugging the respository still show the inserted test records.

16 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share your project to liming.ma@volosoft.com ?

    I will download and check it.

    Thanks.

  • User Avatar
    0
    Karunakar created

    email sent please check and update

  • User Avatar
    0
    Karunakar created

    May be due to permission violation issues you didnt receive the project if not. Please provide a sample project download the module from studio that module cant execute without microservice. After download write a service in appservice project and try to test it by writing sample test cast with test data. When i hit the app service while testing i want to get the repository data to show in app service

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I have downloaded your project, I will check it asap.

    THanks.

  • User Avatar
    0
    Karunakar created

    I am trying with this from last 3 days i need to submit this today, could you please spent some time and please reply ASAP. Thanks!

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Why do you add these services as null mocks?

  • User Avatar
    0
    Karunakar created

    If not added then getting autofac exception

  • User Avatar
    0
    Karunakar created

    please suggest the correct process

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    The template project already contains some test codes; please refer to them.

    They are under the Samples folder.

    and the test document: https://abp.io/docs/latest/tutorials/book-store?UI=NG&DB=EF https://abp.io/docs/latest/tutorials/book-store/part-04?UI=NG&DB=EF

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You are using the wrong way to unit test, you do not need to mock any application services, domain managers and repositories.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I suggest you follow this document

    https://abp.io/docs/latest/tutorials/book-store?UI=NG&DB=EF https://abp.io/docs/latest/tutorials/book-store/part-04?UI=NG&DB=EF

  • User Avatar
    0
    Karunakar created

    If you seen I followed the same but still getting my repository getting null in reository_tests after test data seeded. If you had some free time we can connect for a while

  • User Avatar
    0
    Karunakar created

    or else could you please share my project by correct it how exactly we need to write?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You have set a random tenantid for your entities.

    they why you can't query them. because https://abp.io/docs/latest/framework/infrastructure/data-filtering

    we have source code for the sample https://github.com/abpframework/abp-samples/tree/master/BookStore-Mvc-EfCore

  • User Avatar
    0
    Karunakar created

    Now, evertything working fine many thanks!.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09