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.
Actually the
releaseof anResourceStepis 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
ResourceStepcan 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:
And maybe introduce a way to compose such
ResourceSteptogether.val GivenAdminUserAndProject = WithAdminUser("root").andThen(WithProject("project1"))This could replace
beforeEachScenarioandafterEachScenario.