Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

BDD test structure

Структура BDD тестов

  • Be the first to comment

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 «» Message.user: message Message.user: message Message.user: message