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

[Feature Request] Nested suites apply outer suites' setup-teardown #41

Open
AlejandroCabeza opened this issue Feb 21, 2024 · 0 comments

Comments

@AlejandroCabeza
Copy link

AlejandroCabeza commented Feb 21, 2024

Problem

You can nest suites inside other suites, yet the setup and teardown operations don't behave intuitively. The reason is outer setup-teardowns don't get called when running inner suites.

Suggested solution

Nesting suites should make the outer setup and teardown be called when running tests belonging to inner suites, also wrapping the inner setup-teardowns.

Example

The following sample test:

suite "Suite 0":
  setup:
    echo "+ Setup 0"

  teardown:
    echo "- Teardown 0"

  suite "Suite 1":
    setup:
      echo "+ Setup 1"

    teardown:
      echo "- Teardown 1"

    test "x":
      echo "x"

  suite "Suite 2":
    setup:
      echo "+ Setup 2"

    teardown:
      echo "- Teardown 2"

    test "y":
      echo "y"

Would currently print the following:

+ Setup 1
x
- Teardown 1
+ Setup 2
y
- Teardown 2

Where the expected behaviour is:

+ Setup 0
+ Setup 1
x
- Teardown 1
- Teardown 0
- Setup 0
+ Setup 2
y
- Teardown 2
- Teardown 0
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