Software Engineering 2 (SWT2) Chapter 5: Getting you ready for the project - Lego Scrum Exercise, Git, Infrastructure, your next week, Testing, PO presentation -
Agenda 2 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
Lego Scrum Exercise 3 Goal of the exercise recap all Scrum meetings Practice for next weeks Background: {Hasso Larry} bought an lonesome island Your task: develop the island for tourism
Lego Scrum Exercise 4 Ingredients A0 map Lots of Lego Post It s Timeboxed activities (3x) Planning (5min) Conduct sprint (10min) Review (3min) Retrospective (2min) I like, I wish (in team) I like, I wish (in group)
Lego Scrum Exercise 5 Planning PO presents User Story (we prepared some) Design session / Task break down Estimation Time left? Next Story Conduct sprint
Lego Scrum Exercise 6 Review Team presents User Story results PO accepts/rejects Retrospective What can be improved? Process adjustments? How do you feel?...
Lego Scrum Exercise 7
Lego Scrum Exercise 8 POs are encouraged to adjust User Stories remove/add User Stories refine User Stories SMs keep track of estimations keep track of time oversee Scrum process moderate meetings
Lego Scrum Exercise 9 Group Hasso Lego now! 5 teams (three are split up [G2, H2 & W2]) HS1 + Foyer Group Larry Lego at 1:30pm 5 teams (three are split up [D1, M1 & M2]) HS1 + Foyer
Agenda 10 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
Git 11
Agenda 12 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
Email 13 Mailing lists swt2_2010@hpi.uni-potsdam.de swt2_2010_hasso, swt2_2010_hasso_{po sm} swt2_2010_larry, swt2_2010_larry_{po sm} swt2_2010_{b1 d1 d2 g1 g2 h1 h2 m1 m2 n1 n2 p1 w1 w2 hp1 hp2} Keep your teammates in the loop Rules / filters are your friend Anonymous email address: swt2.2010.anonym@googlemail.com
Time Management 14 Google Calendar Advantages: Available Everywhere Easy Integration with Outlook & ical (see Useful Links in Wiki) Overview of team appointments Access granted by tutors
Continuous Integration 15 Problem: How to check continously that your software works? Solution: Continuous Integration (CI) Server Connected to version control Customizable run scripts Ideally covering all development branches Checkout prepare environment run tests run statistics Examples: CruiseControl, Anthill Our system: Hudson (http://hudson-ci.org/) http://ares.epic.hpi.uni-potsdam.de/swt2-ci/ Deployment to: Hasso: http://192.168.30.90:10080 Larry: http://192.168.30.90:11080
Application Lifecycle Management 16 Integrating tools for most common activities in one place Wiki, Bug Tracking, Time Management, Project Analytics, Some examples: MS Team Foundation Server, Codebeamer, Plan.io Wiki + tracker Track + Agilo plugin Agilo (http://www.agile42.com) http://ares.epic.hpi.uni-potsdam.de/swt2-agilo/{hasso larry}/
Agenda 17 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
Application Stub 18
Application Stub 19
Application Stub 20 (Almost) no models, controllers, or views given Basic UI and navigation concept is given IT Systems Engineering!= UI Designer Share re-usable code in helpers
Agenda 21 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
Your next week in a nutshell 22 Project start Planning meeting (SM moderates) PO & teams agree on sprint goal Team capacity is estimated PO presents 1 st user story from his product backlog Team writes down tasks Task sizes are estimated Capacity left? Done yes Architecture / coordination meeting(s)
Agenda 23 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
Introduction into Testing in Rails 24 Test-driven Design Design and documentation practice Writing tests before writing code 1. Write test 2. See test fail 3. Write simplest solution 4. See test pass 5. Refactor 6. See test pass, GoTo 1 Red/green/refactor
Introduction into Testing in Rails 25 TDD tends to depend on implementation specifics BDD tries to describe the behavior of the code under test The same is true at application level Warning: You do not know what the application should do? do not apply TDD / BDD Instead: do a spike (proof of concept) Throw the code away afterwards
RSpec 26 Write executable examples of the expected behavior of a small bit of code in a controlled context describe UserList! do context "when first created" do! it "is empty" do! user_list = UserList.new! user_list.should be_empty! end! end! end! When run in a shell: UserList when first created is empty [Chelimsky et al.: The Rspec Book, 2010]
BDD cycle 27 [Chelimsky et al.: The Rspec Book, 2010]
BDD cycle 28 [Chelimsky et al.: The Rspec Book, 2010]
Directory Comparison 29
30 Cucumber
Implementing Cucumber Steps 31 rake cucumber FEATURE=features/add_author.feature Scenario: Add a simple author! Given I am on the authors page! When I follow "Add author"! And I fill in the example author! And I press "Save"! Then I should be on the authors page! And there should be the example author! And no error should occur!
Implementing Cucumber Steps 32 Scenario: Add a simple author # features/add_author.feature:8 Given I am on the authors page # features/step_definitions/web_steps.rb:19 When I follow "Add author" # features/step_definitions/web_steps.rb:33 And I fill in the example author # features/step_definitions/standard_entries.rb:47 And I press "Save" # features/step_definitions/web_steps.rb:27 Then I should be on the authors page # features/step_definitions/web_steps.rb:195 And there should be the example author # features/step_definitions/standard_entries.rb:69 And no error should occur # features/add_author.feature:15 Undefined step: "no error should occur" (Cucumber::Undefined) features/add_author.feature:15:in `And no error should occur' 1 scenario (1 undefined), 7 steps (1 undefined, 6 passed), 0m0.282s You can implement step definitions for undefined steps with these snippets: Then /^no error should occur$/ do pending # express the regexp above with the code you wish you had end
Implementing Cucumber Steps 33
Implementing Cucumber Steps 34 Feature: Add author In order to add an author As a user I want to enter the details into a form and confirm Then the author should be in the database And I should be taken back to the authors index page Scenario: Add a simple author # features/add_author.feature:8 Given I am on the authors page # features/step_definitions/web_steps.rb:19 When I follow "Add author" # features/step_definitions/web_steps.rb:33 And I fill in the example author # features/step_definitions/standard_entries.rb:47 And I press "Save" # features/step_definitions/web_steps.rb:27 Then I should be on the authors page # features/step_definitions/web_steps.rb:195 And there should be the example author # features/step_definitions/standard_entries.rb:69 And no error should occur # features/step_definitions/my_steps.rb:1 1 scenario (1 passed), 7 steps (7 passed), 0m0.213s
35 RSpec
Hello RSpec 36 describe "RSpec Greeter" do! it "should say 'Hello RSpec!' when it receives the greet () message" do! end! end! greeter = RSpecGreeter.new! greeting = greeter.greet! greeting.should == "Hello RSpec!"! Given When Then rake spec:models
Hello RSpec 37 JM:swt2_10_exercise juergen$ rake spec:models (in /.../2010_WS_SWT2/vl2_exercise/swt2_10_exercise) F Failures: 1) RSpec Greeter should say 'Hello RSpec!' when it receives the greet() message Failure/Error: greeter = RSpecGreeter.new uninitialized constant RSpecGreeter #./spec/models/hello_spec.rb:5 Finished in 0.3104 seconds, 1 example, 1 failure
Hello RSpec 38 require 'spec_helper'! class RSpecGreeter! def greet! "Hello RSpec!"! end! end! describe "RSpec Greeter" do! it "should say 'Hello RSpec!' when it receives the greet() message" do! end! end! greeter = RSpecGreeter.new! greeting = greeter.greet! greeting.should == "Hello RSpec!"!
Hello RSpec 39 JM:swt2_10_exercise juergen$ rake spec:models (in /.../2010_WS_SWT2/vl2_exercise/swt2_10_exercise). Finished in 0.65165 seconds, 1 example, 0 failures JM:swt2_10_exercise juergen$ bundle exec rspec spec/models/ hello_spec.rb --format d RSpec Greeter should say 'Hello RSpec!' when it receives the greet() message Finished in 0.44836 seconds, 1 example, 0 failures
Further Information on RSpec 40 Next lectures http://rspec.info/documentation/ http://rspec.info/rails/writing/models.html @user.should_not be_valid @user.should have(1).error_on (:username) @user.should be_valid target.should satisfy { arg...} target.should_not satisfy { arg...} target.should equal <value> target.should not_equal <value> target.should be_close <value>, <tolerance> target.should_not be_close <value>, <tolerance> target.should be <value> target.should_not be <value> target.should be < 6 target.should == 5 target.should_not == 'Samantha target.should match <regex> target.should_not match <regex> target.should be_an_instance_of <class> target.should_not be_an_instance_of <class> target.should be_a_kind_of <class> target.should_not be_a_kind_of <class> target.should respond_to <symbol> target.should_not respond_to <symbol> target.should have(<number>).things target.should have_at_least (<number>).things target.should have_at_most (<number>).things target.should have(<number>).errors_on (:field)
Agenda 41 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
Outlook 42 TDD BDD Testing in Rails Unit::Test RSpec Cucumber Test doubles Factories
Agenda 43 Lego Scrum Exercise Git Project Infrastructure Application Stub Your next week in a nutshell Introduction into Testing in Rails Outlook PO Presentation
PO Presentation 44
Thank you for your attention!
Backup
Lego Scrum Exercise 47 Exercise should take place in positive atmosphere POs really should adopt the given User Stories (except in Sprint 1) If no questions by team occur during sprint, something might be wrong PO should not accept any solution (acceptance criteria has to be met) If same acceptance criteria is repeated over and over, a Definition of Done might be introduced (probably with the Street User Story Scrum Master should moderate meetings Meetings have a fixed end (timeboxed) At the end of a meeting, the group can decide to add a few more minutes BUT, it is not allowed to just overrun the meeting end! The retrospective is a unique opportunity for team learning Teams should vary their process they can work alone, in teams of 2, 3, 4,... Make sure to capture the ideas, problems, etc. that come up during this exercise might they come up in the Software project as well?
Practical Examples 48 RSpec Buch ab S. 61 RSpec Buch bis S. 200 UNIT::TEST im TestReceipes Buch ist auch gut (bspw. bis S. 101)
Fixtures 49
Fixtures, 1:n relationship 50
Fixtures, n:m relationship 51
Fixtures 52 In spec_helper: fixtures:all!
Test Run 53
Setup and Teardown 54
Setup and Teardown 55