Introduction
BDD is an extension of the TDD concept. BDD emphasizes the involvement of interested technical groups and non-technical teams in the software development process. It can be seen as an agile approach that emphasizes inter-group collaboration. Most teams that adopt some kind of agile approach will eventually follow many of the principles of BDD. When writing unit tests, try to name the tests using the BDD style. The BDD style emphasizes the use of complete, descriptive names or terminology that is easy for business users to understand and avoids the use of technical terminology. BDD expects the names of classes, methods, and variables to reflect everyday language as much as possible.
I. Development environment and TOOLS
1.1 Visual Studio
1.2 Resharp 10.0 or later
1.3 Specflow
Visual Studio menu tools, extensions and updates.
Nuget
Second, Demand
Enter a clear text, encrypted with DES encryption into ciphertext.
Enter a cipher to decrypt the decrypted form of des into plaintext.
Third, Code Structure
Four, add a story or feature file
Modify a Story
Five, Writing test Code
Six, Run the test code
It is recommended that you compile your code before running.
The test was a natural failure because there was no function to implement.
Seven, writing code implementation capabilities
Test Pass
The need for decryption in a similar way.
Eight, Add Requirements
When you enter an empty string, it is encrypted with Des, and an empty string should be returned.
When entering null, the ArgumentNullException should be thrown with DES encryption.
Nine, Add a new story
10. write a new test code
11. run the test code again
When encrypting an empty string, it does not return an empty string and does not match expectations.
When NULL is encrypted, the ArgumentNullException is thrown, which matches the expected.
12. adjust the code to make the encrypted empty string meet the requirements
13. Source Code
Https://github.com/ErikXu/SimpleBDD
14, I GitHub
Https://github.com/ErikXu
Recently want to put their own GitHub business, welcome to exchange more people.
Behavior-Driven Development (BDD) Practice examples