1 / 18

Tying It All Together

Tying It All Together . Dealing with HttpContext , etc. Things that will make your code untestable :. public ActionResult Index() { Session[“ foo ”] = “bar”; var productName = Request.Form [“Product_3_Name”]; }. Dealing with HttpContext , etc. Use HttpInterfaces instead!.

marcia-wade
Download Presentation

Tying It All Together

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tying It All Together

  2. Dealing with HttpContext, etc. Things that will make your code untestable: public ActionResult Index() { Session[“foo”] = “bar”; varproductName = Request.Form[“Product_3_Name”]; }

  3. Dealing with HttpContext, etc. Use HttpInterfaces instead! public OrderController(IHttpSession session, IHttpRequest request) { _session = session; _request = request; } public ActionResult Index() { _session[“foo”] = “bar”; varproductName = _request.Form[“Product_3_Name”]; } Now we have interfaces instead of unmockable abstract base classes!

  4. Cucumber/SpecFlow Write executable specifications that drive a browser Given I am a logged in user And there are products in my cart When I click the “New Order” link Then the list of products in my cart should be empty

  5. A Whole Team Approach to Testing

  6. Cucumber/SpecFlow vs. testing controllers

  7. Test coverage

  8. Have a testing mindset

  9. Have a holistic testing strategy

  10. Dealing with legacy code

  11. Dealing with skeptics

  12. Think long term

  13. Practice makes perfect

  14. Patience

  15. Courage

  16. Higher standards

  17. ?

  18. Slides, links, code, contact info Slides, code, links: http://jonkruger.com/blog/tdd-immersion Email: jon@jonkruger.com Twitter: @JonKruger Blog: http://jonkruger.com/blog

More Related