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
VNC Recording does not work with JUnit 5 #1341
Comments
I've added a test to check the post-condition of a local container. However the test implementation is all but elegant. I've no idea on how to better test an extension like this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this. |
Should this issue be closed? |
I'm still unable to record videos in JUnit 5 tests, so I guess this is still open. |
Currently I'm using the following workaround
|
The issue should be addressed by #1326 |
@roamingthings I have tried with #1326 (cloned from this PR) then it passed (first I wrongly used above code still with the @ExtendWith(Junit5VncRecoder.class) ) but after it worked, is there a plan to release it soon ? |
@tyge68 Unfortunately i don't know either when the PR becomes part of the release but I hope that it will be accepted soon. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this. |
I have a slightly different solution than @StasKolodyuk . @StasKolodyuk ist super straightforward but it will cause problems when you want to run multiple tests in parallel. If you need parallel test, you may check out my workaround from |
@joerg-pfruender Did you also look at #1326 ? This solves the general problem notification of Testcontainers in JUint 5. |
@roamingthings Sorry, I did not see that. Would be great to have that. |
@joerg-pfruender As you might have seen it's not an easy task. |
As #1326 was merged into the new release 1.14.0, does this mean that this issue is resolved? |
@TheHaf it does! Please test :) |
@roamingthings @bsideup @TheHaf Thank you very much for your efforts. I hope c3d37e4 will soonly find its way to a release because currently the recorded videos are stored somewhere in a arbitrary temp folder and not in the specified folder. On thing, I would like to have improved: The current implementation forces me to always initialize a container as a field in my test. But I often want to choose dynamically in different scenarios between a local webdriver (for debugging with the browser's developer tools), a remote webdriver or testcontainer's webdriver. The current implementation forces me: Always initialize and start testcontainers webdriver and get videos or choose dynamically and get no videos. Maybe I am the only person in the world with that requirements. If not, I will try think about a solution... |
Is the issue resolved? I still face issues with video recording after test execution. I'm using TestNG instead of JUnit.
I'm currently using 1.14.3 version of Testcontainer Please let me know if there's anything I could do to make this work. |
The Issue is solved. Your BrowserWebdriverContainer must be a field in the test, annotated with @container to work with videos. You should not start/stop the container in your code. That is done by hooks initialized by the @testcontainers annotation. It scans for fields annotated with @container and executes their start/stop methods. If you do not put your BrowserWebdriverContainer into a @container annotated field and start/stop it on your own, then the framework can not inform the container if the test has failed and there will be no video on failing tests. https://joerg-pfruender.github.io/software/testing/2020/03/29/testcontainers.html https://github.com/joerg-pfruender/webdriver-testcontainers-junit5 |
@sharath2106 the feature is implemented for JUnit 5. If you're using an unsupported framework (like TestNG), you need to handle the test lifecycle yourself (see |
When I have a plain old JUnit 4 test where I am using
@Rule
:Everything works fine. I am getting this in the logs:
But if I have JUnit 5 test where I am using
@Testcontainers
+@Container
:The test is ok (passed), but there is no recording file. Nothing on the logs, just:
The text was updated successfully, but these errors were encountered: