Quarkus CLI tooling possible without Quarkus?

60 views
Skip to first unread message

Sebastian Daschner

unread,
Jun 9, 2021, 9:01:55 AM6/9/21
to Quarkus Development mailing list
Hey there,

This question at first sounds a bit weird, but I was wondering whether it's possible to extract the command line functionality that executes the tests into a seperate tooling / process.

What I'm looking for is to run tests in plain Java (not Quarkus) projects with the same speed. The continuous testing of quarkus:dev is currently one of the fastest ways to execute tests -- measuring time from keystroke to test result, this is much faster than the usual IDEs. So first, congratulations for that! :)

What I did as a poc was to add the Quarkus BOM and some dependency (quarkus-resteasy) plus the Maven Plugin, which seems to me is the minimal configuration, but of course a workaround, but that works. Now, it would be nice to have some sort of tool that "compiles everything, executes my tests, either continuously or via keystroke" in the same fast way (< 900ms).

WDYT?

Cheers,
Sebastian

Eduardo Ramirez Ronco

unread,
Jun 9, 2021, 9:29:05 AM6/9/21
to Quarkus Development mailing list

Hi Sebastian,

If you don't need anything Quarkus specific, will the Gradle continuous testing work for you?


At the end of that section, you can see something like: gradle test --continuous --tests "com.mypackage.foo.*"


Best regards,

Eduardo Ramírez ronco

Services Content Architect

Red Hat Global Learning Service



--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAK1U5v8%3Dj3Xj2DWa1PSwW%2Bwu_7ALv-idtt0g%3Di2OKUb1Ohifdg%40mail.gmail.com.

Sebastian Daschner

unread,
Jun 9, 2021, 12:13:54 PM6/9/21
to eram...@redhat.com, Quarkus Development mailing list
Hi Eduardo,

In general, that sounds promising. Do you know if there is something Maven-specific available?

Best,
Sebastian

Eduardo Ramirez Ronco

unread,
Jun 9, 2021, 12:52:13 PM6/9/21
to Quarkus Development mailing list

Stuart Douglas

unread,
Jun 9, 2021, 9:33:03 PM6/9/21
to ma...@sebastian-daschner.com, Quarkus Development mailing list
On Wed, 9 Jun 2021 at 23:02, Sebastian Daschner <ma...@sebastian-daschner.com> wrote:
Hey there,

This question at first sounds a bit weird, but I was wondering whether it's possible to extract the command line functionality that executes the tests into a seperate tooling / process.

What I'm looking for is to run tests in plain Java (not Quarkus) projects with the same speed. The continuous testing of quarkus:dev is currently one of the fastest ways to execute tests -- measuring time from keystroke to test result, this is much faster than the usual IDEs. So first, congratulations for that! :)

Thanks :-)
 

What I did as a poc was to add the Quarkus BOM and some dependency (quarkus-resteasy) plus the Maven Plugin, which seems to me is the minimal configuration, but of course a workaround, but that works. Now, it would be nice to have some sort of tool that "compiles everything, executes my tests, either continuously or via keystroke" in the same fast way (< 900ms).

This is all very much tied into our existing Quarkus infrastructure. From resolving the test ClassPath, ClassLoading, compilation, and transforming tests to allow usage tracking everything is built around the Quarkus architecture. The code that actually runs the tests is one of the smallest and simplest pieces of the whole thing.

It is certainly possible to take the same concepts and ideas and implement them outside of Quarkus, however you would mostly need to write the whole thing from scratch. This is also much harder if you start trying to allow this for arbitrary environments, as you need to have a custom ClassLoader implementation to allow the modified code to be dropped and re-loaded, and I guarantee you will run into ClassLoading problems at some point that we have solved in Quarkus. It was a lot of work to get this to the current level of polish in an environment we control completely, it's going to be even harder if you want it to work for everything in the Java ecosystem.

I'm sure someone will do it eventually, but it will be a lot of work to get it to the same level.

Stuart

Sebastian Daschner

unread,
Jun 10, 2021, 4:31:09 AM6/10/21
to Stuart Douglas, Quarkus Development mailing list
Thanks for your responses, Stuart & Eduardo!


This is all very much tied into our existing Quarkus infrastructure. From resolving the test ClassPath, ClassLoading, compilation, and transforming tests to allow usage tracking everything is built around the Quarkus architecture. The code that actually runs the tests is one of the smallest and simplest pieces of the whole thing.

It is certainly possible to take the same concepts and ideas and implement them outside of Quarkus, however you would mostly need to write the whole thing from scratch. This is also much harder if you start trying to allow this for arbitrary environments, as you need to have a custom ClassLoader implementation to allow the modified code to be dropped and re-loaded, and I guarantee you will run into ClassLoading problems at some point that we have solved in Quarkus. It was a lot of work to get this to the current level of polish in an environment we control completely, it's going to be even harder if you want it to work for everything in the Java ecosystem.

That's what I assumed, which is why I wondered whether it would be possible to run just the existing maven-quarkus-plugin without the necessity for the other dependencies, i.e. on a regular Maven (JAR) project. Right now, as a workaround, a Quarkus dep needs to be present at least (otherwise exceptions arise).

Is this something that might be feasible?

Cheers,
Sebastian

Stuart Douglas

unread,
Jun 10, 2021, 4:50:27 AM6/10/21
to Sebastian Daschner, Quarkus Development mailing list
You could add the dependency in a profile so it is only present when you are running tests?

Stuart

Sebastian Daschner

unread,
Jun 10, 2021, 5:33:09 AM6/10/21
to Stuart Douglas, Quarkus Development mailing list
Nice, that works -- 34 LoC to make a plain Java project a Quarkus-fast-testing one. I'll create a blog/video about that, I think that's cool.

Thanks!

Stuart Douglas

unread,
Jun 10, 2021, 10:36:35 PM6/10/21
to Sebastian Daschner, Quarkus Development mailing list
Even though it works for simple stuff I don't know if it would work for more complex stuff, as you may run into class loading issues (e.g. things like logging will be a problem). Even though I understand why it works, I must say I was never really expecting anyone to use it this way.

Also if you are recording a video you may want to wait till the .Final release and use mvn quarkus:test instead of quarkus:dev. I have made a lot of small changes to polish the experience in the last week that should make the overall experience nicer.

Stuart
Reply all
Reply to author
Forward
0 new messages