Fitnesse Stl Code Camp


Published on

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Fitnesse Stl Code Camp

  1. 1. Fitnesse and .NET Achieving Customer Zen With Fitnesse
  2. 2. Overview <ul><li>The problem with customers… </li></ul><ul><li>Figuring out what customers want </li></ul><ul><li>Executable Specifications </li></ul><ul><li>How Fitnesse can help </li></ul><ul><li>Fitnesse Demos </li></ul><ul><li>Wrap-up </li></ul>
  3. 3. The Customer Problem <ul><li>If we don’t take care of the customers, maybe they’ll stop bugging us </li></ul>
  4. 4. The Customer Problem <ul><li>Customers aren’t developers </li></ul><ul><li>Developers aren’t (usually) customers </li></ul><ul><li>Customers don’t know what they want until they see it </li></ul>
  5. 5. What Customers Want <ul><li>How do we show customers what they want? </li></ul><ul><ul><li>In a way they can understand </li></ul></ul><ul><ul><li>In a way that elicits immediate feedback </li></ul></ul><ul><ul><li>In a way that allows them to explore </li></ul></ul><ul><ul><li>Without building entire system </li></ul></ul>
  6. 6. What Customers Want <ul><li>Mock-Ups </li></ul><ul><ul><li>Screen grabs </li></ul></ul><ul><ul><li>Sketches on paper or whiteboard </li></ul></ul><ul><ul><li>Visio Diagrams </li></ul></ul><ul><ul><li>Good for initial discussions </li></ul></ul><ul><ul><li>Allows customer to explore in some fashion </li></ul></ul><ul><ul><li>Hard to keep up with the latest state of the system </li></ul></ul>
  7. 7. What Customers Want <ul><li>Prototyping </li></ul><ul><ul><li>Make a throw away version </li></ul></ul><ul><ul><li>Allows customer interaction at a more concrete level </li></ul></ul><ul><ul><li>More expensive than mock-ups </li></ul></ul><ul><ul><li>Customers may not understand difference between prototype and real system </li></ul></ul><ul><ul><li>May be hard to keep up with the real system </li></ul></ul>
  8. 8. What Customers Want <ul><li>Frequent Releases </li></ul><ul><ul><li>Shows customer what is finished </li></ul></ul><ul><ul><li>Shows customer the current state of the system </li></ul></ul><ul><ul><li>Hard for customer to explore with </li></ul></ul><ul><ul><li>Customer has to wait for release to play with new version </li></ul></ul><ul><ul><li>Customer can only explore GUI elements </li></ul></ul>
  9. 9. What Customers Want <ul><li>Need something between prototype and actual release </li></ul><ul><li>Ties domain concepts to code </li></ul><ul><li>Proves when feature is done – in a repeatable fashion </li></ul><ul><li>Customer-centric and developer friendly </li></ul><ul><li>Ties as closely as possible to the real system </li></ul>
  10. 10. Executable Specifications <ul><li>A way of modeling specifications in a way that allows them to be executed to prove the system meets the spec </li></ul><ul><li>Abstract State Model </li></ul><ul><ul><li>Any algorithm can be modeled at its natural abstraction level by an appropriate ASM </li></ul></ul><ul><ul><li>By being able to run the model, you can validate the algorithm </li></ul></ul>
  11. 11. Executable Specifications <ul><li>The appropriate abstraction level for business problems is usually a business (or domain) specific language </li></ul><ul><li>By allowing the domain language to be executable, users get fast feedback </li></ul><ul><li>Domain concepts can be translated directly into code </li></ul>
  12. 12. How Fitnesse Helps <ul><li>Which is clearer? </li></ul><ul><li>This? </li></ul>[Test] public void CreateRoomAddsRoomToRoomList() { Assert.AreEqual(0, chatApp.AvailableRooms.Count); chatApp.CreateRoom(“aRoom”, “aUser”); Assert.AreEqual(1, chatApp.AvailableRooms.Count); Room room = chatApp.AvailableRooms.GetRoomByName(“aRoom”); Assert.AreEqual(1, room.UserCount); Assert.IsTrue(room.Users.Contains(“aUser”)); }
  13. 13. How Fitnesse Helps <ul><li>Or this? </li></ul>Create user presses Basketball user enters room name of John user enters username of John 1 Basketball user list user count room name list of rooms
  14. 14. How Fitnesse Helps <ul><li>So what is this magical Fitnesse? </li></ul><ul><ul><li>Two pieces </li></ul></ul><ul><ul><ul><li>FIT (Framework for Integration Tests) </li></ul></ul></ul><ul><ul><ul><li>Fitnesse </li></ul></ul></ul><ul><ul><li>Allows specifications to be written in HTML, Excel or Wiki format </li></ul></ul><ul><ul><li>Can use any language underneath (runners for .NET, Java, Python, Ruby and others) </li></ul></ul>
  15. 15. How Fitnesse Helps <ul><li>Fitnesse </li></ul><ul><ul><li>Uses Wiki format </li></ul></ul><ul><ul><li>Allows collaborative efforts between customers and developers </li></ul></ul><ul><ul><li>Is about communication first, testing second </li></ul></ul><ul><ul><li>Easy to use syntax </li></ul></ul><ul><ul><li>Straightforward to hook to the system being tested </li></ul></ul>
  16. 16. How Fitnesse Helps <ul><li>Different Types of Tables </li></ul><ul><ul><li>ColumnFixture </li></ul></ul><ul><ul><li>RowFixture </li></ul></ul><ul><ul><li>DoFixture </li></ul></ul><ul><ul><li>ActionFixture </li></ul></ul><ul><ul><li>Custom Fixtures </li></ul></ul><ul><ul><li>Many others </li></ul></ul>
  17. 17. How Fitnesse Helps <ul><li>Helps solve 3 major problems </li></ul><ul><ul><li>Communication </li></ul></ul><ul><ul><li>Agility </li></ul></ul><ul><ul><li>Balance </li></ul></ul><ul><li>Side effect benefits </li></ul><ul><ul><li>Regression tests </li></ul></ul><ul><ul><li>Domain concepts exposed </li></ul></ul>
  18. 18. Chat Application Demo <ul><li>Chat Application </li></ul><ul><ul><li>Customer wants a simple chat application where users can create rooms and join existing ones </li></ul></ul><ul><ul><li>Specifications are being captured into Fitnesse fixtures and hooked to the system under test </li></ul></ul>
  19. 19. Chat Application Demo <ul><li>Specification Example </li></ul>ChatTests.Application start ChatTests.Application user list user count room name list of rooms Create user presses Basketball user enters room name of John user enters username of John 1 Basketball user list user count room name list of rooms
  20. 20. Chat Application Demo <ul><li>Customer found a hole in the specification by writing Fitnesse tests </li></ul><ul><li>When the last user leaves, the room should be deleted </li></ul>
  21. 21. Chat Application Demo <ul><li>Because the domain concepts are translated into code, the developers can quickly write the corresponding unit test </li></ul>
  22. 22. Chat Application Demo <ul><li>And then get the unit test to pass by writing the code </li></ul>
  23. 23. Chat Application Demo <ul><li>And because Fitnesse ties into the system under test, we can see our change meets the specification immediately </li></ul>
  24. 24. Business Rules Demo <ul><li>The table based nature of Fitnesse is excellent for communicating Business Rules </li></ul><ul><li>If you can capture the concepts in a table form, you can write it in Fitnesse </li></ul>
  25. 25. Business Rules Demo <ul><li>Business Holidays </li></ul><ul><ul><li>Different businesses have different days which they may count as holidays </li></ul></ul><ul><ul><li>Interfacing with them may mean having to know what holiday applies to what business </li></ul></ul><ul><ul><li>Sounds like a good Fitnesse test! </li></ul></ul>
  26. 26. Business Rules Demo <ul><li>Fitnesse Test and Code </li></ul>
  27. 27. Business Rules Demo <ul><li>Shipping Charges </li></ul><ul><ul><li>Online store with shopping cart </li></ul></ul><ul><ul><li>Shipping Charges are based on order amounts </li></ul></ul><ul><ul><li>Customers get free shipping if they are over a set amount, or if they have preferred customer status </li></ul></ul>
  28. 28. Business Rules Demo <ul><li>We want an initial user list we can reuse throughout our tests </li></ul>
  29. 29. Business Rules Demo <ul><li>Our other fixtures can now make use of our setup code </li></ul>
  30. 30. Wrap-up <ul><li>Focus on using Fitnesse to communicate with your customers first </li></ul><ul><li>Then use Fitnesse as a regression testing tool </li></ul><ul><li>Having Fitnesse tests shouldn’t be an excuse not to write unit tests </li></ul>
  31. 31. Wrap-up <ul><li>Fitnesse Resources </li></ul><ul><ul><li>Fit for Developing Software by Rick Mugridge and Ward Cunningham </li></ul></ul><ul><ul><li>Fitnesse website ( ) </li></ul></ul><ul><ul><li>Fitnesse mailing list ( ) </li></ul></ul><ul><ul><li>Fitnesse tutorials ( http:// ) </li></ul></ul>