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

Allow Assertions (So statements) that do not terminate test case #696

Open
llarsen71 opened this issue Jan 9, 2025 · 1 comment
Open

Comments

@llarsen71
Copy link

Right now, if an assertion fails, the test terminates. There are cases where this is exactly what is wanted since assertions that follow may then be invalid. However, I often run into cases, where assertions are not sequentially dependent and I want to run the rest of the assertions so that I know all of the issues that need to be fixed. With the current logic, I have to run the tests, fix an error, rerun the tests, fix another error, and repeat until all errors are fixed. This wastes time. Having a nonterminating assertion option would help fix this.

@llarsen71 llarsen71 changed the title Allow Assertions (So statements) that do not terminate completion of test Allow Assertions (So statements) that do not terminate test case Jan 9, 2025
@llarsen71
Copy link
Author

After some digging into the code, I found that there is an option that causes tests to continue after a test fails. This is done by passing FailureContinues as an option tot he Convey function as shown below:

func TestExample(t *testing.T) {
  Convey("Given ...", FailureContinues, func() {
    ...
    // So statements will not cause the test to terminate in this convey block
    // or any child convey blocks.
  })
}

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

No branches or pull requests

1 participant