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

JUnit 5 #68

Open
rkawala opened this issue Nov 30, 2016 · 6 comments
Open

JUnit 5 #68

rkawala opened this issue Nov 30, 2016 · 6 comments

Comments

@rkawala
Copy link

rkawala commented Nov 30, 2016

We don't have an immediate need for JUnit 5, but as Spring moves forward we might want to start using it. Are there any plans to make Spectrum work with JUnit 5?

@greghaskins
Copy link
Owner

Certainly, I'd say JUnit5 is in the longer-term roadmap for Spectrum. I'd like to generalize Spectrum a bit so that it can run on multiple backend running/reporting frameworks like JUnit4, JUnit5, Cucumber or possibly others. We would have a set of adapters for running Spectrum tests on top of those various tools.

@gajwani
Copy link

gajwani commented Jun 26, 2017

+1

I was also looking at putting this onto a project, and although (as @rkawala mentioned) it's not an urgent necessity, I think having JUnit 5 support would be great.

If you can elaborate on your plans for supporting JUnit 5, maybe someone (potentially me, if I get some time) can help by submitting a Pull Request.

Thanks!

@greghaskins
Copy link
Owner

@gajwani Thanks for reaching out (and sorry for not responding sooner!).

I touched on this a little bit Design Philosophy wiki page.

Overall, it might look like:

  • Start the process of decoupling the existing codebase from JUnit 4 (with adapters/interfaces as necessary). A spectrum-core would probably emerge that is agnostic of which framework gets used (the outermost layer). This is probably a multi-PR process over time (and we've already been moving in this direction).
  • Split out the distribution so that spectrum-junit4 (which would depend on spectrum-core) can be used as a drop-in for the original (as-is today) Spectrum package.
  • Implement a spectrum-junit5 package (again, depending on spectrum-core) that runs on top of the latest JUnit5 framework.

Full disclosure, I haven't learned much about the JUnit5 migration path. I do know that they intend for the versions to not conflict with each other, so perhaps there is a better way. I'm very much interested in ideas and feedback.

From what I have read, it does seem like integrating Spectrum on top of the JUnit5 Platform API (TestEngine) will be much simpler, since there is a direct abstraction available for non-traditional test runners like ours.

@sbrannen
Copy link

From what I have read, it does seem like integrating Spectrum on top of the JUnit5 Platform API (TestEngine) will be much simpler, since there is a direct abstraction available for non-traditional test runners like ours.

Yes! That is indeed the idea behind the TestEngine abstraction. 😉

@jwedel
Copy link

jwedel commented Aug 11, 2018

JUnit 5 support would actually be great. I was just about writing a Jasmine-style extension myself when I though I should google it first. So is there any plan to support it since JUnit 5 is getting a lot of traction right now?

@jwedel
Copy link

jwedel commented Aug 12, 2018

From what I have read, it does seem like integrating Spectrum on top of the JUnit5 Platform API (TestEngine) will be much simpler, since there is a direct abstraction available for non-traditional test runners like ours.

I've actually forked the repo to play with it. I've removed the junit-4 deps to see what breaks. So I see a couple of issues that needs to be addressed.

  1. The current implementation is coupled to Junit 4. Spectrum provides both an API and is a test Runner implementation at the same time. I'm a bit uncertain about how we would expose the API to the test class. Extending the test class with Spectrum?
  2. The Suite class is a mix of describing the tests (JUnit 4 Description) as well as holding the actual tests and executing them. This needs to be decoupled as already mentioned.
  3. The concept of a JUnit 4 Runner implies that it will be called for each test class annotated with Spectrum. A TestEngine is instantiated only once per test run and needs to know all tests and is able to filter for specific tests. So we need to have one abstraction that supports both.

Full disclosure: This is the first time I was looking into the Spectrum code base, so I might get stuff wrong.

For reference, I looked into jqwik which already implements TestEngine.

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

No branches or pull requests

5 participants