Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1606 context loader listener not initialized during controller tests #1608

Conversation

nya-elimu
Copy link
Member

closes #1606

@nya-elimu nya-elimu requested a review from a team as a code owner August 6, 2022 07:15
@nya-elimu nya-elimu requested review from jpatel3, tomaszsmy and eymaal and removed request for a team August 6, 2022 07:15
@codecov
Copy link

codecov bot commented Aug 6, 2022

Codecov Report

Merging #1608 (eaf83f0) into main (b00de2d) will increase coverage by 0.46%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               main    #1608      +/-   ##
============================================
+ Coverage     13.45%   13.91%   +0.46%     
- Complexity      445      453       +8     
============================================
  Files           256      256              
  Lines          8378     8409      +31     
  Branches        845      876      +31     
============================================
+ Hits           1127     1170      +43     
+ Misses         7207     7187      -20     
- Partials         44       52       +8     
Impacted Files Coverage Δ
.../content/contributor/EditMotivationController.java 9.09% <0.00%> (-0.44%) ⬇️
...imu/web/content/letter/LetterCreateController.java 6.25% <0.00%> (-0.21%) ⬇️
...elimu/web/content/letter/LetterEditController.java 5.71% <0.00%> (-0.17%) ⬇️
...nce/LetterSoundCorrespondenceCreateController.java 5.00% <0.00%> (-0.13%) ⬇️
...dence/LetterSoundCorrespondenceEditController.java 4.25% <0.00%> (-0.10%) ⬇️
...ontent/multimedia/audio/AudioCreateController.java 2.10% <0.00%> (-0.03%) ⬇️
.../content/multimedia/audio/AudioEditController.java 1.12% <0.00%> (-0.01%) ⬇️
...ontent/multimedia/image/ImageCreateController.java 2.24% <0.00%> (-0.03%) ⬇️
.../content/multimedia/image/ImageEditController.java 1.07% <0.00%> (-0.01%) ⬇️
...imu/web/content/number/NumberCreateController.java 4.16% <0.00%> (-0.09%) ⬇️
... and 28 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@nya-elimu
Copy link
Member Author

@tomaszsmy In db8dd40, you'll see that I did some refactoring of tests that stopped passing when I added WordCreateControllerTest::testHandleSubmit_success. The WordCreateControllerTest affected the WordContributionEventDaoTest because they are both looking up words stored in the database.

So to make tests less fragile, I suggest we write them in such a way that they will still work even though other tests are storing similar content in the database. One way to do that, is to not expect a specific number of entities stored in the database, but instead look at the total number stored before and after individual test. This is because it should be okay if the database already contains content before running through individual tests, so no need to delete content after tests either. I hope all this makes sense 🙂

@nya-elimu nya-elimu merged commit 52f96ac into main Aug 25, 2022
@nya-elimu nya-elimu deleted the test-#1606-ContextLoaderListener-not-initialized-during-controller-tests branch August 25, 2022 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ContextLoaderListener not initialized during controller tests
2 participants