fix: Tests failing due to disabling JUnitPlatform which is causing 0% coverage reports#1218
fix: Tests failing due to disabling JUnitPlatform which is causing 0% coverage reports#1218abubkr-hago wants to merge 2 commits intoparse-community:masterfrom abubkr-hago:fix-failing-tests
Conversation
Thanks for opening this pull request!
|
|
I think you have the wrong base for this PR, the base branch does not seem to be up-to-date, hence the file conflicts. Also, in #1216 I removed But I'm unsure whether the tests before ran on JUnit 5 or 4, because we have these 2 dependencies: Maybe we were using JUnit 5, so removing |
Yes, I continued working on the same branch. |
This seems to be a better solution, downgrading JUnit would probably cause more issues later on. |
|
I'm not sure whether the PR has effectively downgraded it, because of the 2 dependencies. Do you see which JUnit version the tests are running with? |
It did, the current version is |
|
Good News, I got a 1% coverage report after refactoring imports to It seems we will need to refactor all test files to use |
It turns out only one runtime can be used when testing, meaning this and the previous builds were running JUnit4 all the time. |
|
Interesting; so what is the solution? Stick with JUnit 4 for now? Does it require a lot of changes? |
I think we will have to stick with JUnit4 for now, coverage is still not reporting though, look at It doesn't require a lot of changes, I'll just have to fix the remaining errors. |
|
Sounds good; could you remove the unrelated changes from this PR, so we can merge it? |
Do you mean remove the changes related to upgrading different packages? and keep the changes related to fixing the failing tests? There are still 3 failing tests I'm trying to figure out:
|
Yes, only keep changes related to fixing coverage. Other changes should move into their dedicated PRs. |
|
This PR mentions this issue #1217. |
|
Oh nice, with that, can we mix Junit 4 and 5 tests? Because at some point I guess we'll have to start migrating, or maybe require newly added tests to be written already in JUnit 5. |
|
Yes both JUnit4 and Jupiter (JUnit5) tests can be mixed now. |
|
Very nice! |
|
Could you take a look at the failing CI? Edit: Increased the lint timeout from 5 to 10 mins. |
|
Re-running the CI, but it fails. @abubkr-hago do you remember how we wanted to proceed here? There were a couple of PRs open. |
|
Sorry for the late response, I got a job and got very busy. |
|
Hello, @mtrezza let's have first the #1213 merged. Probably after that the project can be configured via https://github.com/mannodermaus/android-junit5 this plugin to have both JUnit 4 and JUnit 5. This plugin requires AGP to be higher then 8.0.0 Another approach would be to downgrade the tests to JUnit 4 but I remember when I was doing some version bump I migrate to JUnit 5 because I thought it should be supported well and because of some issues with the tests. Looks like JUnit 4 is still preferable for Android setup. |
|
Oh the intention was the other was around I believe. The other one has codecov not working anymore, so this one was opened. This should already support both JUnit versions. |
New Pull Request Checklist
Issue Description
Some tests are failing after disabling JUnitPlatform.
Closes: #1217.
Approach
Fix failing tests without enabling JUnitPlatform.
TODOs before merging