-
Notifications
You must be signed in to change notification settings - Fork 0
Step names
Michael W Powell edited this page Dec 7, 2020
·
1 revision
Like Cucumber, xWellBehaved.net does not make any distinction between Given, When, Then, And, and But steps.
"Given the number 1".x(() => x = 1);
"And the number 2".x(() => y = 2);
"And a calculator".x(() => calculator = new Calculator());
"When I add the numbers together".x(() => answer = calculator.Add(x, y));
"Then the answer is 3".x(() => Assert.Equal(3, answer));
Instead of using Given, When, Then, you may choose to use another vocabulary, such as the Arrange, Act, Assert pattern for organizing Unit Test code in methods.
"Arrange 1"x(() => x = 1);
"Arrange 2".x(() => y = 2);
"Arrange calculator".x(() => calculator = new Calculator());
"Act".x(() => answer = calculator.Add(x, y));
"Assert".x(() => Assert.Equal(3, answer));
Or xSpec style:
"Establish 1".x(() => x = 1);
"Establish 2".x(() => y = 2);
"Establish calculator".x(() => calculator = new Calculator());
"Because I add the numbers together".x(() => answer = calculator.Add(x, y));
"It answers 3".x(() => Assert.Equal(3, answer));
You can even extend xWellBehaved.net with method and attribute names which are better suited to your chosen vocabulary.
- Home
- Quick start
-
Documentation
- Writing scenarios
- Running scenarios
- Package dependencies
- Debugging scenarios
- Assertions
- Step names
- Debugging Scenarios with examples
- Background methods
- TearDown methods
- Async steps
- Object disposal
- Rollback
- Skipping steps and scenarios
- Step metadata
- Continuing on failure
- Step filters
- Changes in xBehave.net version 2.0
- Changes since deriving from xBehave.net
- Extending xWellBehaved.net
- FAQ
- Known Issues
- Contributions