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

Reuse frontend build from tests #419

Open
alexkolson opened this issue Jul 5, 2023 · 12 comments
Open

Reuse frontend build from tests #419

alexkolson opened this issue Jul 5, 2023 · 12 comments
Labels
enhancement New feature or request

Comments

@alexkolson
Copy link

Feature idea

Currently if you have quinoa run your tests, it builds your frontend twice, once for tests, and then once later in the quarkus:build phase. It would save quite a lot of time if the build that was done to run the tests could be re-used in the quarkus:build step so that builds are slightly faster. I'm not sure it's possible, but I thought I'd ask anyway. If it can't be done or you would not like to do this, I totally understand! Maybe there's even a way I can do this as a user of quinoa already and I just haven't looked hard enough? Either way, thanks in advance!

@ia3andy
Copy link
Collaborator

ia3andy commented Jul 5, 2023

That's a good idea. I haven't implemented it yet because even if the build-dir already exists it's hard to predict when it should or shouldn't be rebuilt.

@geoand @aloubyansky do we have some kind of build id (to find out if we are in the same build/test sequence)?

@geoand
Copy link
Contributor

geoand commented Jul 5, 2023

We do not AFAIK

@ia3andy
Copy link
Collaborator

ia3andy commented Jul 5, 2023

We do not AFAIK

Would it make sense to introduce it?

@geoand
Copy link
Contributor

geoand commented Jul 5, 2023

It hasn't been necessary so far, so it's hard to say

@aloubyansky
Copy link
Member

Prod and test resources may have differences. It might be tricky to evaluate whether an existing build outcome can be re-used as the outcome of the subsequent build.

@melloware melloware added the enhancement New feature or request label Jul 15, 2023
@alexkolson
Copy link
Author

I totally agree that is a tricky issue but I would still suggest that it would be a useful feature. Especially for things like playwright tests in combination with continuous testing, where the package.json build command gets re-run for each test run.

@alexkolson
Copy link
Author

To simplify things (maybe) the first version could perhaps just be a property like quarkus.quinoa.build-frontend-once-for-tests=true (better naming needed of course).

@ia3andy
Copy link
Collaborator

ia3andy commented Sep 12, 2023

I agree this is a pain!

What we could do is to generate some kind of hash based on the webui directory and store it in the quinoa build directory, this could be enabled through configuration.

@edeandrea
Copy link

edeandrea commented Jun 7, 2024

I'm running into this as well, and its frustrating because the Quinoa build takes a while. If I have more than one test class with @TestProfile(QuinoaTestProfiles.Enable.class) then that seems to have quarkus kill the app, rebuild, and restart between test classes.

In Quarkus couldn't we instead group test execution by test classes that have the same @TestProfile, and then keep the same app instance up between those test classes?

We already do something like that for @QuarkusTestResource don't we?

@geoand / @aloubyansky ?

@ia3andy
Copy link
Collaborator

ia3andy commented Jun 7, 2024

@edeandrea test are not using the dev mode, it builds the app.

We could have a similar option to what @alexkolson suggested and have a specific target directory for test and not re-build if already there, but I think we need a way to clean it automatically.

@edeandrea
Copy link

edeandrea commented Jun 7, 2024

But when running the tests the app seems to be rebuilt between test class execution (I have logs that I can show that it does). The app is shut down, the rebuild happens, and then the app restarts.

I have exactly the same use case as @alexkolson - a bunch of test classes that use Playwright to test various pages in a react app.

When my tests execute, it would be nice if the app just stayed up in between test class execution. I'm not talking about dev mode.

I can solve this by only having a single test class that has

@QuarkusTest
@TestProfile(QuinoaTestProfiles.Enable.class)
@WithPlaywright

and then have @Nested classes within, each nested class representing one of my page tests. That works, but it makes my test class really big (thousands of lines). I'd rather keep my test classes separated (one test class per page being tested).

I actually see this more of a generic Quarkus issue than a Quinoa issue. I can observe similar behavior if I remove Quinoa and just create my own custom QuarkusTestProfile and then have multiple test classes that use @TestProfile(MyTestProfile.class). Can't Quarkus be smart enough to organize test execution so that all test classes that use the same @TestProfile share the same app instance and don't require a rebuild?

@geoand
Copy link
Contributor

geoand commented Jun 7, 2024

We already do something like that for @QuarkusTestResource don't we?

Indeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants