Loopt   Heine Frifeldt <heine@loopt.com>         Server Team Manager        Tools used for testing                        ...
Loopt - Connecting You with the Places You Go                                                2
Kiln for source control, wiki and bug tracking                                                 3
DB Schema in Mercurial viaRedGate SQL Source Control                             4
Unit tests via Visual Studio 2010                                    5
Continuous builds via Jenkins                                6
Nightly Functional Tests via custom attribute      [TestMethod, ExecuteNightly]      public void FacebookSearch()      {  ...
Hard to test code that uses staticspublic Configuration GetConfiguration(){     string[] conf = File.ReadAllLines("Config....
Constructors as like static methods          Keep them simplepublic class User{     public User(int userId)     {         ...
Hard to test code that has objectinitialization inside business logic public Deal[] GetGrouponDeals() {      WebClient cli...
Separate object graph from logic   Ie. remove new operatorspublic GrouponAdapter(ILooptWebClient webClient){     _webClien...
Dependency injection  Test able code[TestMethod]public void VerifyDeals(){     var testClient = new TestWebClient();     ...
Root of application will have logic to       construct object graphspublic CoreService(         IDealManager dealManager, ...
Use “Ninject” to construct object graph … _kernel.Get<GrouponAdapter>(); …                                          14
Use “Ninject” to construct object graph … Bind<ILooptWebClient>().To<LooptWebClient>(); …                                 ...
“Moq” as object mock framework[TestMethod]public void VerifyDeals(){     var testClient = new Mock<ILooptWebClient>();    ...
Manage packages via NuGet                            17
Queries into log files via Splunk                                    18
Key benchmarks on TV screen via Gecko Board                                              19
Tool Resources   •   Source Control – Mercurial via Kiln        • http://www.fogcreek.com/kiln/   •   SQL Tools - Redgate ...
Upcoming SlideShare
Loading in …5
×

BizSpark SF Lightning Talk: "Automated Testing (Unit, Integration and Systems)" by Heine Frifeldt

479 views

Published on

Presentation from November 2011 BizSparkSF Meetup entitled "Tools, Tools and More Tools!" http://www.bizsparksf.com/events/34653282/

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
479
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • What is Loopt?
  • App for various cell phonesfriends around you answer/see structured questions at places
  • No test wo/ source controlMercurialNice w/ all tools consolidated =&gt; code reviews
  • Besides code, keep DB changes in MercurialExtends SQL Manager
  • Used to use Nunit, but much simpler with integrated env
  • Click specific build and see changeset
  • Problem; flaky tests bc invoke 3rd party code =&gt; functional test
  • To explain next tool, need to provide some background
  • Bad practice, but even with lazy data access, still need the database
  • Another class of code, hard to testGoing hit Groupon and no control
  • Address issues we started using DIAsk for what you need
  • Now you control the WebClientSeparate object graph from logic
  • Ends up happening =&gt; construct all dependencies in root app
  • Construct cascading list of dependencies =&gt; cumbersome =&gt; NinjectReflect over adapter =&gt; webClient
  • No magic.When figures you need ILooptWebClient =&gt; need binding for implementation
  • In doing DI =&gt; test classes =&gt; Moq frameworkMock LooptWebClient =&gt; describe what to return
  • To get these framework =&gt;NuGet, VS extensionAdd reference =&gt; add from 3rd party software lib
  • Diff kind of test =&gt; monitoring.Once deployed =&gt; index log files =&gt; search able via Splunk
  • Picked key benchmarks from Splunk =&gt; dashboard via Gecko BoardIn the hallway for all engineers
  • BizSpark SF Lightning Talk: "Automated Testing (Unit, Integration and Systems)" by Heine Frifeldt

    1. 1. Loopt Heine Frifeldt <heine@loopt.com> Server Team Manager Tools used for testing 1
    2. 2. Loopt - Connecting You with the Places You Go 2
    3. 3. Kiln for source control, wiki and bug tracking 3
    4. 4. DB Schema in Mercurial viaRedGate SQL Source Control 4
    5. 5. Unit tests via Visual Studio 2010 5
    6. 6. Continuous builds via Jenkins 6
    7. 7. Nightly Functional Tests via custom attribute [TestMethod, ExecuteNightly] public void FacebookSearch() { var adapter = new FacebookAdapter(); var places = adapter.Search(coords, 10000); Assert.IsTrue(places.Count() > 0); } 7
    8. 8. Hard to test code that uses staticspublic Configuration GetConfiguration(){ string[] conf = File.ReadAllLines("Config.xml"); // parse contents and construct Configuration obj … 8
    9. 9. Constructors as like static methods Keep them simplepublic class User{ public User(int userId) { DataProvider provider = new DataProvider(); var data = provider.GetUserInfo(userId); … } 9
    10. 10. Hard to test code that has objectinitialization inside business logic public Deal[] GetGrouponDeals() { WebClient client = new WebClient(); // Logic to retrieve and parse the response … } 10
    11. 11. Separate object graph from logic Ie. remove new operatorspublic GrouponAdapter(ILooptWebClient webClient){ _webClient = webClient;}public Deal[] GetGrouponDeals(){ // Use _webClient to retrieve URL … 11
    12. 12. Dependency injection  Test able code[TestMethod]public void VerifyDeals(){ var testClient = new TestWebClient(); var groupon = new GrouponAdapter(testClient); // Now you control the URL response …} 12
    13. 13. Root of application will have logic to construct object graphspublic CoreService( IDealManager dealManager, IUserManager userManager, …public DealManager( IGrouponAdapter grouponAdapter, IDataProvider dataProvider, IPoiController poiController) 13
    14. 14. Use “Ninject” to construct object graph … _kernel.Get<GrouponAdapter>(); … 14
    15. 15. Use “Ninject” to construct object graph … Bind<ILooptWebClient>().To<LooptWebClient>(); … 15
    16. 16. “Moq” as object mock framework[TestMethod]public void VerifyDeals(){ var testClient = new Mock<ILooptWebClient>(); testClient. Setup(c => c.GetUrl(It.IsAny<Uri>())). Returns(Resources.MyResponse); var groupon = new GrouponAdapter(testClient); …} 16
    17. 17. Manage packages via NuGet 17
    18. 18. Queries into log files via Splunk 18
    19. 19. Key benchmarks on TV screen via Gecko Board 19
    20. 20. Tool Resources • Source Control – Mercurial via Kiln • http://www.fogcreek.com/kiln/ • SQL Tools - Redgate SQL Source Control / SQL Compare • http://www.red-gate.com/products/sql-development/ • Automated Build Environment – Jenkins • http://jenkins-ci.org • Dependency Injection / Testable code • http://misko.hevery.com/2008/11/11/clean-code-talks-dependency-injection • Dependency Injection Framework – Ninject • http://ninject.org • Mock Framework – Moq • http://code.google.com/p/moq • Library extension for Visual Studio – Nuget • http://nuget.org • Log file Index and Parser – Splunk • http://www.splunk.com • Engineering dashboard – Gecko board • http://www.geckoboard.com 20

    ×