8000 Add junit 5 engine for zio tests. Resolves zio/zio#6724 by vincent-raman · Pull Request #9214 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add junit 5 engine for zio tests. Resolves zio/zio#6724 #9214

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

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

vincent-raman
Copy link
Contributor
@vincent-raman vincent-raman commented Sep 23, 2024

/closes #6724

Aim of this development is to provide a junit engine working directly with junit 5 platform without the need of exteding ZTestJUnitRunner and using the junit-vintage engine

10000
@vincent-raman vincent-raman force-pushed the feature/junit-engine branch 6 times, most recently from dd1a572 to 2556f66 Compare September 23, 2024 18:42
Copy link
Contributor
@kyri-petrou kyri-petrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this took so long to review. I'm fairly unfamiliar with junit, so I only have some high-level comments at the moment

Comment on lines +597 to +599
lazy val testJunitEngine = project.module
.in(file("test-junit-engine"))
.settings(stdSettings("zio-test-junit-engine"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rationale behind creating a new module instead of updating the existing one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is different. Test-junit implements a JUnit 4 Runner that allows "junit-vintage" engine (compatibility layer to run JUnit 3 and 4 tests with the JUnit 5 platform) to discover the tests that extend this class. In this case, it's a new JUnit test engine able to discover by itself the ZIO tests

build.sbt Outdated
.settings(stdSettings("zio-test-junit-engine"))
.settings(
libraryDependencies ++= Seq(
"org.junit.jupiter" % "junit-jupiter-api" % "5.11.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this dependency necessary? I couldn't figure out where it's being used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10000 Indeed

<encoding>UTF-8</encoding>
<scala.version>2.13.13</scala.version>
<scala.compat.version>2.12</scala.compat.version>
<zio.version>2.0.22</zio.version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for using version 2.0.22?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter, it's overwritten by the test with the current version. This is only a template. The concept was taken from "test-junit-tests". The idea is the same as this project: we run simple tests with maven to check that the engine picks them and reports them correctly


import scala.util.Try

object ReflectionUtils {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make this object private right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling that this file is placed in the wrong parent. Shouldn't it be under test-junit-engine-tests/src instead of test-junit-engine-tests/maven/src?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As explained previously, the maven folder is a folder containing a template maven project, used in the scala tests to check that the engine picks them and reports them correctly. The concept was copied from "test-junit-tests". Imho, I would have put that in a resources folder, but I wanted to be coherent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

@jdegoes
Copy link
Member
jdegoes commented Nov 8, 2024

@vincent-raman Ready to merge when feedback from @kyri-petrou is addressed. Thanks for your contribution!

@kyri-petrou
Copy link
Contributor

@vincent-raman can you run the formatter (i.e., sbt fmt) and commit? PR is good to go otherwise :)

Copy link
Contributor
@kyri-petrou kyri-petrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

@kyri-petrou kyri-petrou merged commit 462ffe1 into zio:series/2.x Nov 11, 2024
18 checks passed
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.

Add JUnit 5 TestEngine support
3 participants
0