-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add junit 5 engine for zio tests. Resolves zio/zio#6724 #9214
Conversation
dd1a572
to
2556f66
Compare
There was a problem hiding this 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
lazy val testJunitEngine = project.module | ||
.in(file("test-junit-engine")) | ||
.settings(stdSettings("zio-test-junit-engine")) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
@vincent-raman Ready to merge when feedback from @kyri-petrou is addressed. Thanks for your contribution! |
2556f66
to
5ef37ba
Compare
@vincent-raman can you run the formatter (i.e., |
5ef37ba
to
b89b906
Compare
b89b906
to
f2a5f03
Compare
There was a problem hiding this 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!
/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