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

Control release of ResourceStep #237

Open
yanns opened this issue May 6, 2019 · 2 comments
Open

Control release of ResourceStep #237

yanns opened this issue May 6, 2019 · 2 comments
Labels

Comments

@yanns
Copy link
Collaborator

yanns commented May 6, 2019

Actually the release of an ResourceStep is called at the end of the scenario.
It can make the release process complex if it needs some other information, like a special OAuthToken.

Idea: a ResourceStep can collect steps.
for example: let's see I need an admin user that is deleted after the tests.
This admin user can create projects.
A scenario could be:

{
  WithAdminUser("root") {
    WithProject("project1") {
      When I get("/projects)
      Then assert body.path("count").is(1)

      WithProject("project2") {
        When I get("/projects)
        Then assert body.path("count").is(2)
      } // `project2` is deleted here

      When I get("/projects)
      Then assert body.path("count").is(1)
    } // `project1` is deleted here
  } // `root` is deleted here
}

And maybe introduce a way to compose such ResourceStep together.

val GivenAdminUserAndProject = WithAdminUser("root").andThen(WithProject("project1"))

{
  GivenAdminUserAndProject {
    When I get("/projects)
    Then assert body.path("count").is(1)
  } // `project1` and `root` are deleted here
}

This could replace beforeEachScenario and  afterEachScenario.

@agourlay
Copy link
Owner

agourlay commented May 6, 2019

I like the idea 👍

I will cleanup the concept of Resource in the next release to make space for such feature in the future.

@agourlay
Copy link
Owner

agourlay commented Jul 5, 2023

Partially tackled in #785

Composing resources needs to be researched once we get user feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants