SlideShare a Scribd company logo
Loopt

   Heine Frifeldt <heine@loopt.com>
         Server Team Manager

        Tools used for testing




                                      1
Loopt - Connecting You with the Places You Go




                                                2
Kiln for source control, wiki and bug tracking




                                                 3
DB Schema in Mercurial via
RedGate 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()
      {
           var adapter = new FacebookAdapter();
           var places = adapter.Search(coords, 10000);
           Assert.IsTrue(places.Count() > 0);
      }




                                                         7
Hard to test code that uses statics


public Configuration GetConfiguration()
{
     string[] conf = File.ReadAllLines("Config.xml");

    // parse contents and construct Configuration obj
    …




                                                        8
Constructors as like static methods
          Keep them simple

public class User
{
     public User(int userId)
     {
          DataProvider provider = new DataProvider();
          var data = provider.GetUserInfo(userId);
          …
     }




                                                        9
Hard to test code that has object
initialization inside business logic

 public Deal[] GetGrouponDeals()
 {
      WebClient client = new WebClient();

     // Logic to retrieve and parse the response
     …
 }




                                                   10
Separate object graph from logic
   Ie. remove new operators

public GrouponAdapter(ILooptWebClient webClient)
{
     _webClient = webClient;
}

public Deal[] GetGrouponDeals()
{
     // Use _webClient to retrieve URL
     …




                                                   11
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
Root of application will have logic to
       construct object graphs

public CoreService(
         IDealManager dealManager,
         IUserManager userManager,
         …



public DealManager(
         IGrouponAdapter grouponAdapter,
         IDataProvider dataProvider,
         IPoiController poiController)



                                           13
Use “Ninject” to construct object graph



 …
 _kernel.Get<GrouponAdapter>();
 …




                                          14
Use “Ninject” to construct object graph



 …
 Bind<ILooptWebClient>().To<LooptWebClient>();
 …




                                                 15
“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
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 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

More Related Content

TXT
Birhanu distributive assignment
PDF
Take Control of your Integration Testing with TestContainers
PDF
Enterprise Guice 20090217 Bejug
PDF
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
PDF
Do something in 5 with gas 9-copy between databases with oauth2
PDF
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
PDF
Nestjs MasterClass Slides
PPTX
Test and profile your Windows Phone 8 App
Birhanu distributive assignment
Take Control of your Integration Testing with TestContainers
Enterprise Guice 20090217 Bejug
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Do something in 5 with gas 9-copy between databases with oauth2
Hacking the Mesh: Extending Istio with WebAssembly Modules | DevNation Tech Talk
Nestjs MasterClass Slides
Test and profile your Windows Phone 8 App

What's hot (18)

PPTX
Goa tutorial
PDF
Advanced Java Testing
PDF
Creating your own project's Quality Dashboard
PPTX
Entity framework practices
PDF
Springを用いた社内ライブラリ開発
PDF
End to end todo list app with NestJs - Angular - Redux & Redux Saga
PPT
SQL Server 2005 CLR Integration
DOCX
Custom faultpolicies
PPTX
Jasig Cas High Availability - Yale University
PDF
mDevCamp - The Best from Google IO
PDF
Grails Integration Strategies
PDF
Create a Core Data Observer in 10mins
PDF
Core Data with multiple managed object contexts
KEY
Taking a Test Drive
PDF
Form認証で学ぶSpring Security入門
PDF
OrientDB - The 2nd generation of (multi-model) NoSQL
PDF
Managing user's data with Spring Session
PDF
NHibernate Configuration Patterns
Goa tutorial
Advanced Java Testing
Creating your own project's Quality Dashboard
Entity framework practices
Springを用いた社内ライブラリ開発
End to end todo list app with NestJs - Angular - Redux & Redux Saga
SQL Server 2005 CLR Integration
Custom faultpolicies
Jasig Cas High Availability - Yale University
mDevCamp - The Best from Google IO
Grails Integration Strategies
Create a Core Data Observer in 10mins
Core Data with multiple managed object contexts
Taking a Test Drive
Form認証で学ぶSpring Security入門
OrientDB - The 2nd generation of (multi-model) NoSQL
Managing user's data with Spring Session
NHibernate Configuration Patterns
Ad

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

PPTX
Selenium Camp 2012
PPT
Building Quality with Foundations of Mud
PDF
Design For Testability
PDF
Test and Behaviour Driven Development (TDD/BDD)
PDF
Poly Source It Profile
PDF
Polysource It Profile
DOC
10265 developing data access solutions with microsoft visual studio 2010
PPTX
Introductie Visual Studio ALM 2012
PPTX
Introductie Visual Studio ALM 2012
PPTX
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
PPTX
Testability for developers – Fighting a mess by making it testable
PDF
GR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
PPTX
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
PDF
Silverlight 2
DOCX
Actively looking for an opportunity to work as a challenging Dot Net Developer
DOCX
Actively looking for an opportunity to work as a challenging Dot Net Developer
PDF
Website qa
PDF
Testing-Tools-Magnitia-Content.pdf
PDF
Architecting a Large Software Project - Lessons Learned
Selenium Camp 2012
Building Quality with Foundations of Mud
Design For Testability
Test and Behaviour Driven Development (TDD/BDD)
Poly Source It Profile
Polysource It Profile
10265 developing data access solutions with microsoft visual studio 2010
Introductie Visual Studio ALM 2012
Introductie Visual Studio ALM 2012
Silverlight And .Net Ria Services – Building Lob And Business Applications Wi...
Testability for developers – Fighting a mess by making it testable
GR8Conf 2011: Tuning Grails Applications by Peter Ledbrook
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
Silverlight 2
Actively looking for an opportunity to work as a challenging Dot Net Developer
Actively looking for an opportunity to work as a challenging Dot Net Developer
Website qa
Testing-Tools-Magnitia-Content.pdf
Architecting a Large Software Project - Lessons Learned
Ad

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Approach and Philosophy of On baking technology
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
A Presentation on Artificial Intelligence
PPTX
Machine Learning_overview_presentation.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
Network Security Unit 5.pdf for BCA BBA.
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25-Week II
Spectral efficient network and resource selection model in 5G networks
A comparative study of natural language inference in Swahili using monolingua...
Univ-Connecticut-ChatGPT-Presentaion.pdf
cloud_computing_Infrastucture_as_cloud_p
Reach Out and Touch Someone: Haptics and Empathic Computing
Mobile App Security Testing_ A Comprehensive Guide.pdf
A comparative analysis of optical character recognition models for extracting...
Approach and Philosophy of On baking technology
SOPHOS-XG Firewall Administrator PPT.pptx
A Presentation on Artificial Intelligence
Machine Learning_overview_presentation.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Group 1 Presentation -Planning and Decision Making .pptx

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

  • 1. Loopt Heine Frifeldt <heine@loopt.com> Server Team Manager Tools used for testing 1
  • 2. Loopt - Connecting You with the Places You Go 2
  • 3. Kiln for source control, wiki and bug tracking 3
  • 4. DB Schema in Mercurial via RedGate SQL Source Control 4
  • 5. Unit tests via Visual Studio 2010 5
  • 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. Hard to test code that uses statics public Configuration GetConfiguration() { string[] conf = File.ReadAllLines("Config.xml"); // parse contents and construct Configuration obj … 8
  • 9. Constructors as like static methods Keep them simple public class User { public User(int userId) { DataProvider provider = new DataProvider(); var data = provider.GetUserInfo(userId); … } 9
  • 10. Hard to test code that has object initialization inside business logic public Deal[] GetGrouponDeals() { WebClient client = new WebClient(); // Logic to retrieve and parse the response … } 10
  • 11. Separate object graph from logic Ie. remove new operators public GrouponAdapter(ILooptWebClient webClient) { _webClient = webClient; } public Deal[] GetGrouponDeals() { // Use _webClient to retrieve URL … 11
  • 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. Root of application will have logic to construct object graphs public CoreService( IDealManager dealManager, IUserManager userManager, … public DealManager( IGrouponAdapter grouponAdapter, IDataProvider dataProvider, IPoiController poiController) 13
  • 14. Use “Ninject” to construct object graph … _kernel.Get<GrouponAdapter>(); … 14
  • 15. Use “Ninject” to construct object graph … Bind<ILooptWebClient>().To<LooptWebClient>(); … 15
  • 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
  • 18. Queries into log files via Splunk 18
  • 19. Key benchmarks on TV screen via Gecko Board 19
  • 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

Editor's Notes

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