-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
You can customize and ignore unit tests with testcontainer #4586
Comments
There's already something for this:
Of course, we'd always recommend running all tests in CI as well as locally, so I hope that you might also be successful in doing this too! |
Thank you very much for your reply. DockerClientFactory#isDockerAvailable () is not static. How do I call him in code? |
Ah sorry, |
Your reply is very helpful to me. Thank you very much |
You're welcome! |
if code makes use of GenericContainer or any other TestContainer based rule then those rules will mostl likely throw an exception when docker is not available. This leads people to add a BeforeClass annotation and test for docker, however this does not skip the tests, it skips the class. This has the unfortuante side effect that the report (from thinks like maven surefire and ant) that the test did not run when ingested into tools like Jenkins (as zero tests from the class either passed failed or skipped). it is also not obvious on the command line. by using a rule the individual tests will be marked as skipped so it becomes obvious that a test existed, but did not run for some reason (and the reason will be in the exception - that docker is not available) fixes testcontainers#4586 / testcontainers#343
My requirements are as follows: my unit test integrates testcontainer, but I only want to run this unit test locally. When using Maven to build on the jekins of the server, I don't want to run unit tests with testcontainer, but I don't want to run all unit tests. Based on this scenario, I propose several solutions:
The text was updated successfully, but these errors were encountered: