-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
I love the fluent API , in fact that is all I really use. I do a lot of testing using fluent methods and it would be nice to be able to pass the current context of where you are in the test sequence into the next step instead of having to hold onto local variables.
Example using pseudo selenium pages:
class Page1 {
public Page1 DoSomething() { returns this; }
public Page2 GoToPage2() { returns new Page2(); }
}
class Page2 { public Page2 DoSomethingElse() { returns this; } }
[Scenario]
public void DoSomeComplexFlow() => Site.NavigateToPage<Page1>()
.Given(page1 => page1.DoSomething(), "Given we do something on page 1")
.And(page1 => page1.GoToPage2()), "And we have gone to page 2")
.When(page2 => page2.DoSomethingElse(), "When doing something else")
.Then(page2 => page2.GetType() == typeof(Page2), "Then we have a context of Page2")
.BDDfy();
This allows a nice flow of the scenario.
On a side note, I don't always use the template syntax that I have done above but when I do it would be nice not to have to prefix everything with Given, When, Then or And.
Anyway that, for me, would be an awesome addition to an already awesome API.
Metadata
Metadata
Assignees
Labels
No labels