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

feat: add require for critical checks #2812

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AshutoshKD
Copy link

What does this PR do?

Using require for essential checks to ensure that tests do not proceed under invalid assumptions, while assert can be used for less critical checks to gather more information about potential issues.

Suggested Usage of assert and require :-

Critical Checks (Use require):
Use require to check critical conditions that must be true for the test to proceed.
If a require condition fails, the test stops immediately. This prevents any further code from running, which could lead to misleading error messages.

Non-Critical Checks (Use assert):
Use assert to evaluate conditions that are important but not critical for the test's overall success.
If an assert condition fails, the test continues to run, allowing multiple assertions to be evaluated.

Why is it important?

It is important to use require for critical conditions so that if a critical check fails, the test execution halts immediately. This prevents the test from continuing to run subsequent assertions, which may rely on the validity of the failed condition, thereby avoiding misleading error messages and ensuring that only relevant failures are reported. This approach enhances the clarity of test results and facilitates quicker identification of the root cause of issues.

Related issues

Copy link

netlify bot commented Oct 3, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 263adaa
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/66ff0ab9aec24c00085da30c
😎 Deploy Preview https://deploy-preview-2812--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AshutoshKD AshutoshKD changed the title add require for critical checks feat: add require for critical checks Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant