Successfully reported this slideshow.
Your SlideShare is downloading. ×

BDD test structure

More Related Content

More from Magneta AI

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

BDD test structure

  1. 1. BDD Test Structure Сергей Баранов
  2. 2. User Story As a [Role] I want [Feature] So that I receive [Value]
  3. 3. Scenario: how? Given [State] When [Action] Then [Reaction]
  4. 4. Domain Model User – зарегистрированный пользователь Habit – привычка Message – сообщение от User к User Chat – место общения двух User
  5. 5. User Story: Send Message As a User I want to send Message to another User who forms the same Habit So that I receive motivation
  6. 6. Scenario: Send Message Given User 1 and User 2 have the same Habit When User 1 sends Message to User 2 Then Both Users receive the Message
  7. 7. Example public void bothUsersShouldRecieveMessagesFromEachOther () { User sender = new User(); User recipient = new User(); Chat chat = new Chat(sender, recipient); given(sender.hasHabit(“Refactoring”)); given(recipient.hasHabit(“Refactoring”)); chat.sendMessage("Aloha!"); then(chat.hasMessage(“Aloha!”)); }
  8. 8. + sendMessage(User who, User whom, String message) + getChat(User, User) – Map<Chat> chats (key: username1+username2, val: Chat) ChatManager + sendMessage(User whoSent, String message) + List<Message> getMessages() – List<Message> messages Chat + Message(User user, String message) + getUser() + getMessage() – User user – String message Message – String username – List<Habit> User – String name Habit <<sendMessage>> <<creates>> <<creates>> Chat with «whom.name» Message.user: message Message.user: message Message.user: message

Editor's Notes

  • Given [Context | State]
    When [Event | Action]
    Then [Outcome | Reaction]
  • Пример модели.

×