Skip to content

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

Open
@strinnityk

Description

@strinnityk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions