SlideShare une entreprise Scribd logo
1  sur  20
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

Contenu connexe

Tendances

SQL Server 2005 CLR Integration
SQL Server 2005 CLR IntegrationSQL Server 2005 CLR Integration
SQL Server 2005 CLR Integration
webhostingguy
 
mDevCamp - The Best from Google IO
mDevCamp - The Best from Google IOmDevCamp - The Best from Google IO
mDevCamp - The Best from Google IO
ondraz
 

Tendances (18)

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

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

Nuxeo - OpenSocial
Nuxeo - OpenSocialNuxeo - OpenSocial
Nuxeo - OpenSocial
Thomas Roger
 
What's New In Apache Lenya 1.4
What's New In Apache Lenya 1.4What's New In Apache Lenya 1.4
What's New In Apache Lenya 1.4
nobby
 
Continuos integration for iOS projects
Continuos integration for iOS projectsContinuos integration for iOS projects
Continuos integration for iOS projects
Aleksandra Gavrilovska
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
Tobias Schneck
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
Tobias Schneck
 

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

A new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp LondonA new tool for measuring performance in Drupal 8 - DrupalCamp London
A new tool for measuring performance in Drupal 8 - DrupalCamp London
 
Android Unit Test
Android Unit TestAndroid Unit Test
Android Unit Test
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
 
Google App Engine Developer - Day2
Google App Engine Developer - Day2Google App Engine Developer - Day2
Google App Engine Developer - Day2
 
Nuxeo - OpenSocial
Nuxeo - OpenSocialNuxeo - OpenSocial
Nuxeo - OpenSocial
 
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
 
A Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaA Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in Java
 
What's New In Apache Lenya 1.4
What's New In Apache Lenya 1.4What's New In Apache Lenya 1.4
What's New In Apache Lenya 1.4
 
Testing your application on Google App Engine
Testing your application on Google App EngineTesting your application on Google App Engine
Testing your application on Google App Engine
 
Testing Your Application On Google App Engine
Testing Your Application On Google App EngineTesting Your Application On Google App Engine
Testing Your Application On Google App Engine
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
Test Automation for NoSQL Databases
Test Automation for NoSQL DatabasesTest Automation for NoSQL Databases
Test Automation for NoSQL Databases
 
Mihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate EverythingMihai Criveti - PyCon Ireland - Automate Everything
Mihai Criveti - PyCon Ireland - Automate Everything
 
Continuos integration for iOS projects
Continuos integration for iOS projectsContinuos integration for iOS projects
Continuos integration for iOS projects
 
Surviving UI Automation Armageddon with BELLATRIX.pptx
Surviving UI Automation Armageddon with BELLATRIX.pptxSurviving UI Automation Armageddon with BELLATRIX.pptx
Surviving UI Automation Armageddon with BELLATRIX.pptx
 
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
UI Testing - Selenium? Rich-Clients? Containers? (SwanseaCon 2018)
 
Agile Swift
Agile SwiftAgile Swift
Agile Swift
 
Inversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionInversion of Control and Dependency Injection
Inversion of Control and Dependency Injection
 
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
UI-Testing - Selenium? Rich-Clients? Containers? @APEX connect 2018
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

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

Notes de l'éditeur

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