jhipster-dotnetcore icon indicating copy to clipboard operation
jhipster-dotnetcore copied to clipboard

Add unit tests for related entities on the generated app

Open ivanmonteiro opened this issue 3 years ago • 2 comments

Overview of the feature request

Add unit tests for related entities on the generated dotnet application.

As an example: Unit tests for Employee should test adding and removing its Department relationship.

Motivation for or Use Case

Currently the unit tests only adds/removes the main entity. Changes to the generator may cause issues regarding relationships and are not caught by tests. This is important to make sure that new PR's are not breaking relationship functionality at this project.

Related issues or PR
  • [x] Checking this box is mandatory (this is just to show you read everything)

ivanmonteiro avatar Sep 30 '20 17:09 ivanmonteiro

Does the Java template generate these test? I was going to peek at the implementation if it does.

kennethlong avatar Jun 17 '22 00:06 kennethlong

Does the Java template generate these test? I was going to peek at the implementation if it does.

Last time I checked the main Jhipster generator didn't generate tests for relationships. Currently the tests only check if relationship is required.

The idea would be to create unit tests that:

  • creates the main entity
  • also creates the dependant entities
  • saves the entity graph to the database
  • verifies that all entities were created/updated
  • also deletes dependant entities and checks if it was properly deleted

ivanmonteiro avatar Jun 21 '22 01:06 ivanmonteiro