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

Introduce Ant build support for the JUnit Platform #512

Closed
schauder opened this issue Sep 15, 2016 · 19 comments
Closed

Introduce Ant build support for the JUnit Platform #512

schauder opened this issue Sep 15, 2016 · 19 comments

Comments

@schauder
Copy link
Contributor

This question came up after a JUnit5 talk of mine:

Is anybody working on a JUnit5-Ant integration?

@sbrannen
Copy link
Member

Nope. Not that I'm aware of.

With that in mind, I'll reword the subject of this issue and make it "up for grabs". 😉

@sbrannen sbrannen changed the title Is there an ANT integration? Introduce ANT build support for the JUnit Platform Sep 15, 2016
@sbrannen sbrannen changed the title Introduce ANT build support for the JUnit Platform Introduce Ant build support for the JUnit Platform Sep 15, 2016
@sbrannen sbrannen added this to the General Backlog milestone Sep 15, 2016
@SqAutoTestTeam
Copy link

SqAutoTestTeam commented Oct 11, 2016

As users of JUnit5 we can say.
The project we work with is built with Ant.
Actually Ant compiles, runs tests, checks code, checks project files, and does many other things.
Now we consider migrating to Junit5 because we find it a modern tool that takes into account mistakes made in past. Although Ant is an old framework that seems to be at the point of extinction, it is still required and we need Ant support as much as we need air to breathe. We are sure that we are not alone.

Later we're going to migrate to gradle (or maven). But at this moment we find it difficult to do both things at the same time - migrate to Junit5 and to gradle (or maven). So it would be very nice if you implement this feature.

@marcphilipp
Copy link
Member

It's been a long time since I've used Ant. I believe it shouldn't be too hard to write an adapter for ConsoleLauncher in Ant, right?

@vvelrath
Copy link

Our team has been using ANT to run the junit tests. Now that I am upgrading to junit 5 to try out dynamic tests with the @testfactory annotation, and the ANT task is failing with the following exception
[junit] Testcase: initializationError took 0.003 sec
[junit] Caused an ERROR
[junit] No runnable methods
[junit] java.lang.Exception: No runnable methods
[junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

Is there any other tool apart from ANT that I can try out?? Any help is appreciated.

Thanks and Regards
Vivekanandh Vel Rathinam

@sormuras
Copy link
Member

sormuras commented May 19, 2017

@vvelrath You could use the Console Launcher standalone JAR from within ANT as a work-around. For example, configure an ANT java task to try out @TestFactory. Here is a Gradle example: junit-platform-standalone.gradle

@veita
Copy link

veita commented Sep 22, 2017

Console Launcher is not an option for us since it would require non-trivial changes on a huge amount of build scripts or even project structures. Let alone interoperability with other task like e.g. code coverage determination.

@jaikiran
Copy link
Contributor

Support for JUnit5 in Ant is currently being implemented. More details here https://www.mail-archive.com/dev@ant.apache.org/msg46487.html and there's a issue in Ant's issue tracker that you can keep a watch on to be notified when the feature is available https://bz.apache.org/bugzilla/show_bug.cgi?id=61796

@sormuras
Copy link
Member

This is great news, @jaikiran

Did you see the PR by @dhilario https://github.com/junit-team/junit5/pull/624/files ? If I remember correctly, it was almost ready to run.

@jaikiran
Copy link
Contributor

Hi @sormuras, I hadn't seen that PR before. I had a look at it now. The approach I followed in my effort to build this integration is a bit different than what's there in the PR you pointed to.

In the approach that I followed, the new junitlauncher task (which is what I call it) is a bit more "native" to Ant. What I mean by that is, it follows/uses existing Ant constructs that users who are familiar with Ant (and junit task) would, I think, feel more used to. For example, Ant has the concept of resource collections which allows users to specify/filter files that they want to provide for test execution. Furthermore, one of the related goals of my efforts was to try and have a similar kind of test result reporting that previous junit task used to provide.

The approach in the linked PR is different to this. It's neither wrong nor bad and has its own pros. It seems to act as a wrapper over JUnit 5 constructs and more closer to it and uses Ant mostly like a pass-through mechanism for constructing the test requests. Again, this isn't a bad thing - I'm just noting the difference in the approach.

To give a better picture of how the proposed junitlauncher task is going to look like, here's a WIP user manual for it (the link is temporary) [1]. More use cases (like specifying package selectors) will be addressed as we go along and this current state is the initial version of what I had in mind.

[1] https://home.apache.org/~jaikiran/temp_workspace/manual/Tasks/junitlauncher.html

@sbrannen
Copy link
Member

@jaikiran, that's looking quite good!

So, your work will be the official Ant support for the JUnit Platform -- is that correct?

If so, I'll close this issue.

@jaikiran
Copy link
Contributor

So, your work will be the official Ant support for the JUnit Platform -- is that correct?

Yes, that's correct. We currently have a dev discussion going on and a PR [1] open which will be reviewed and merged, depending on some of our upcoming Ant release schedule.

[1] apache/ant#60

@sbrannen
Copy link
Member

That's great news!

Thanks for the feedback, @jaikiran.

I am therefore closing this issue since an upcoming release of Ant will provide JUnit Platform support out of the box.

@sbrannen sbrannen removed this from the General Backlog milestone Feb 16, 2018
@sbrannen
Copy link
Member

@jaikiran, I couldn't find your Twitter handle... that I wanted to include in this tweet: https://twitter.com/sam_brannen/status/964476615160942592

@jaikiran
Copy link
Contributor

@sbrannen, I don't have a twitter account :) Thanks for tweeting it to a wider audience!

@jaikiran
Copy link
Contributor

@sbrannen, more of a FYI - we just released Ant 1.10.3 today which now has support for JUnit 5 https://jaitechwriteups.blogspot.in/2018/03/ant-1103-released-with-junit-5-support.html

@sbrannen
Copy link
Member

Awesome! 👏

Thanks for letting us know and sharing the link.

I'll tweet about it ASAP. 👍

@sbrannen
Copy link
Member

@marcphilipp
Copy link
Member

I've created #1352 to add a brief subsection to our User Guide and link to the official documentation.

@jaikiran Is this something you'd be interested in documenting?

@jaikiran
Copy link
Contributor

jaikiran commented Apr 1, 2018

@marcphilipp, sure I can take a look at that one this coming week and send a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants