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

update gradle and junit #557

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

update gradle and junit #557

wants to merge 1 commit into from

Conversation

lsoares
Copy link

@lsoares lsoares commented Jan 2, 2023

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2023

Hello. Thanks for opening a PR on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Jan 2, 2023
@SleeplessByte SleeplessByte reopened this Jan 3, 2023
@SleeplessByte
Copy link
Member

SleeplessByte commented Jan 3, 2023

Hi there @lsoares,

it seems that you're trying to upgrade the forth exercise from JUnit to the newer internal Kotlin test library, as well as upgrade gradle, if I am correct?

  • Could you list some of the benefits?
  • If approved and merged, will you apply the same to all the other exercises, as well as the kotlin-test-runner?
  • Are there potential downsides to this change?
  • Is the built-in Kotlin test suite now standard in "a lot" of Kotlin communities?

Normally we'd discuss changes like this first in issues (now: forum), which is why this PR was automatically closed.

@lsoares
Copy link
Author

lsoares commented Jan 3, 2023

Hey @SleeplessByte

I don't mind discussing this in the forum. Should I?

To answer your questions:
In fact, I'm trying to update JUnit 4 to JUnit 5 - the way I'm doing this is through Kotlin but it's still an upgrade of JUnit.
JUnit 5 was released 6 years ago and JUnit 4 is being slowly deprecated (not sure when).
The benefits of JUnit 5 over JUnit 4 are a lot but for Exercism there are two that are worth it:

  • Parameterized tests are way easier and more readable (more)
  • Exception assertions are greatly improved - no global rules or annotations - just use assertFails with a lambda
  • It supports nested tests (JUnit 4 didn't so in this exercise I could not easily run all tests from the IDE)

The last two bullets apply to this exercise and those were what triggered me to do the PR.

Regarding the upgrade: in 90% of the cases, it's just updating the imports. the remaining 10% is a bit more tricky (I'm referring to the advantages above as they were revamped features)
Yes, I can slowly upgrade the other exercises. However, there's the test runner can easily support both JUnit versions, so we don't need to rush (or even convert all if there are no clear/urgent benefits).

BTW, a question: why is the runner not available from the website?

JUnit 5 is the standard now. Nobody uses 4 in a new project (recall that Kotlin is just wrapping it so that's a detail - we could have imported JUnit 5 directly).
I don't see any downside because the upgrade can be done optionally and per exercise.

@SleeplessByte
Copy link
Member

BTW, a question: why is the runner not available from the website?

The runner would always timeout because gradle startup and build is too slow. The entire execution must be under ten seconds and we were not yet able to get it that low.

@SleeplessByte
Copy link
Member

Can you explain how this change makes it easier to run the tests from the IDE? Documenting that here, in this PR, can aid with future discussions about the topic :)

@lsoares
Copy link
Author

lsoares commented Jan 3, 2023

with JUnit 5 nested abilities:
image

image

with JUnit 4 there's no arrow to run the whole test and it's not visible in the menu as well.
image

PS. I doubt we can run Gradle under 10 secs unless we keep Gradle cache.

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.

2 participants