Integration test in SharePoint

Similar documents
Software Testing. Theory and Practicalities

Continuous Integration

Environment Modeling for Automated Testing of Cloud Applications

MOC 20488B: Developing Microsoft SharePoint Server 2013 Core Solutions

Getting Things Done: Practical Web/e-Commerce Application Stress Testing

Introduction to Automated Testing

Contact for all enquiries Phone: info@recordpoint.com.au. Page 2. RecordPoint Release Notes V3.8 for SharePoint 2013

Gallio: Crafting a Toolchain. Jeff Brown jeff.brown@gmail.com

Generating Test Cases With High Branch Coverage for Web Applications

Advanced Software Testing

Automating Business Processes Using SharePoint Designer

DocAve 6 SDK and Management Shell

Grunt, Gulp & fabs. Build-System and Development-Workflow for modern Web-Applications

Introduction to Records Management in SharePoint 2013

Dsc+Mock: A Test Case + Mock Class Generator in Support of Coding Against Interfaces

Tools for Integration Testing

GlassFish v3. Building an ex tensible modular Java EE application server. Jerome Dochez and Ludovic Champenois Sun Microsystems, Inc.

Intro to Developing for SharePoint Online: What Tools Can I Use?

Server-side OSGi with Apache Sling. Felix Meschberger Day Management AG 124

September 18, Modular development in Magento 2. Igor Miniailo Magento

Complex Event Processing (CEP) Why and How. Richard Hallgren BUGS

Finally, an agile test strategy (that works)! AS OW Test Model, Objectware

Config Guide. Gimmal Smart Tiles (SharePoint-Hosted) Software Release 4.4.0

Jenkins User Conference Herzelia, July #jenkinsconf. Testing a Large Support Matrix Using Jenkins. Amir Kibbar HP

SharePoint 2010 Performance and Capacity Planning Best Practices

How-To: Submitting PDF forms to SharePoint from custom websites

A SharePoint Developer Introduction

XpoLog Center Suite Log Management & Analysis platform

MOC 20467B: Designing Business Intelligence Solutions with Microsoft SQL Server 2012

Continuous Integration and Delivery. manage development build deploy / release

<Insert Picture Here> TDD on a Coherence project

1703 Discovering SharePoint 2007 for Developers

INCREASE YOUR WEBMETHODS ROI WITH AUTOMATED TESTING. Copyright 2015 CloudGen, LLC

Continuous integration for databases using Redgate tools

Cleo Communications. CUEScript Training

Integrated Error-Detection Techniques: Find More Bugs in Java Applications

JapanCert 専 門 IT 認 証 試 験 問 題 集 提 供 者

Sahi Web Automation and Test Tool

Glassfish Architecture.

Developing Web Services with Eclipse and Open Source. Claire Rogers Developer Resources and Partner Enablement, HP February, 2004

Software Engineering Techniques

False Positives & Managing G11n in Sync with Development

Continuous integration for databases using

Building Web Services with Apache Axis2

Ernesto Ongaro BI Consultant February 19, The 5 Levels of Embedded BI

Evaluation of AgitarOne

Developing Microsoft SharePoint Server 2013 Advanced Solutions. Version: Demo. Page <<1/8>>

Lecture 12: Software protection techniques. Software piracy protection Protection against reverse engineering of software

System Management Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice

Real Time Data in Web Applications

Release Automation for Siebel

126 SW 148 th Street Suite C-100, #105 Seattle, WA Tel: Fax:

Hijacking Arbitrary.NET Application Control Flow. Topher Timzen

BPM Software Architecture

Testing, Debugging, and Verification

PHPUnit and Drupal 8 No Unit Left Behind. Paul Mitchum

SharePoint Data Management and Scalability on Microsoft SQL Server

SHAREPOINT 2010 CLIENT SIDE OBJECT MODEL

SharePoint 2010 Monitoring and Troubleshooting. Andrew Lynes, Premier Field Engineer 30 August, 2011

Experimental Evaluation of Distributed Middleware with a Virtualized Java Environment

Designing and Developing Web Applications by using the Microsoft.NET Framework

Everyday Lessons from Rakudo Architecture. Jonathan Worthington

metaengine DataConnect For SharePoint 2007 Configuration Guide

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Content. Development Tools 2(63)

Exam : Oracle 1Z : Oracle WebLogic Server 10gSystem Administration. Version : DEMO

Upping the game. Improving your software development process

SUPPORT POLICY SUPPORT POLICY

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

APPLICATION VIRTUALIZATION TECHNOLOGIES WHITEPAPER

ReSTful OSGi Web Applications Tutorial. Khawaja Shams & Jeff Norris

Agile Business Suite: a 4GL environment for.net developers DEVELOPMENT, MAINTENANCE AND DEPLOYMENT OF LARGE, COMPLEX BACK-OFFICE APPLICATIONS

Shipbeat Magento Module. Installation and user guide

SharePoint 2013 The Essential Migration Process. in association with

@tobiastrelle. codecentric AG 1

Migration and Building of Data Centers in IBM SoftLayer with the RackWare Management Module

Amazon Glacier. Developer Guide API Version

Invocación remota (based on M. L. Liu Distributed Computing -- Concepts and Application

Visual WebGui for ASP.NET Ajax (and other Ajax) Web Developers Learn what makes Visual WebGui not just another Ajax framework

Customer Bank Account Management System Technical Specification Document

Spyware Analysis. Security Event - April 28, 2004 Page 1

Software testing. Objectives

LoadRunner and Performance Center v11.52 Technical Awareness Webinar Training

Achieving business benefits through automated software testing. By Dr. Mike Bartley, Founder and CEO, TVS

Outline. 1 Denitions. 2 Principles. 4 Implementation and Evaluation. 5 Debugging. 6 References

RESPONSES TO QUESTIONS AND REQUESTS FOR CLARIFICATION Updated 7/1/15 (Question 53 and 54)

Winning the Battle against Automated Testing. Elena Laskavaia March 2016

PROGRAMMERS GUIDE. Version 1.x

Managing Application Performance with JBoss Operations Network and OC Systems RTI

Transcription:

Codecamp, SharePoint User Group October 31, 2009

Me Education B.Sc. in Computer Science AP in Computer Science SharePoint experience SharePoint Developer at ProActive since 2007 Questions Just ask Q: Do you have any practical experiences with the topic? A: No, testing has been a small spare time project. Q: How would you recommend testing SharePoint projects? A: For you to decide, and it depends on your needs.

Agenda Software testing Automated functional testing Agenda 1 Introduction Agenda Software testing Automated functional testing 2 Dependency inversion Mocking TypeMock Isolator 3

Agenda Software testing Automated functional testing Software testing Types Functional testing Performance testing Usability testing etc. Functional testing Manual testing Automated testing

Agenda Software testing Automated functional testing Automated functional testing Extent (Units in isolation) (Interaction between Modules) System testing (All components)

Dependency inversion Mocking TypeMock Isolator DEMO 1 Using a testing framework and writing a unit test

Dependency inversion Mocking TypeMock Isolator DEMO 1 Using a testing framework and writing a unit test Write tests before implementation Testing is easy and fun

Dependency inversion Mocking TypeMock Isolator Dependency inversion Goal Decouple high-level components from low-level components Patterns Plugin Service Locator Dependency Injection others?

Dependency inversion Mocking TypeMock Isolator DEMO 2 Dependency inversion

Dependency inversion Mocking TypeMock Isolator DEMO 2 Dependency inversion Use of patterns and interfaces can make testing easier Fakes vs. Stubs vs. unit testing

Dependency inversion Mocking TypeMock Isolator Test Doubles Fake (Simple implemnetation) 1 public int Method () { return 0; } Stub (Records information) 1 public int Method () { MethodCalled = true ; return 0; } Mock (Pre-programmed expectations) 1 public int Method () { Assert. Fail (); return 0; }

Dependency inversion Mocking TypeMock Isolator DEMO 3 Writing a mocking framework

Dependency inversion Mocking TypeMock Isolator DEMO 3 Writing a mocking framework Runtime code generation

Dependency inversion Mocking TypeMock Isolator DEMO 4 Using a mocking framework

Dependency inversion Mocking TypeMock Isolator DEMO 4 Using a mocking framework Some of the MOQ API

Dependency inversion Mocking TypeMock Isolator Limitations of inheritance based mocking Sealed classes Non virtual methods Static methods Depends on dependency inversion

Dependency inversion Mocking TypeMock Isolator TypeMock Isolator Hooks into the CLR profile API and injects code runtime. TypeMock API 1 var web = Isolate. Fake. Instance < SPWeb >(); 2 Isolate. Swap. AllInstances < SPWeb >(). With ( web ); 3 Isolate. Swap. NextInstance < SPWeb >(). With ( web ); 4 Isolate. NonPublic. WhenCalled (web, " Invalidate "). 5 DoInstead ( context => { return ; }); 6 Isolate. Swap. CallsOn (a). WithCallsTo (b); Criticism: Too powerful

Dependency inversion Mocking TypeMock Isolator DEMO 5 Testing an SharePoint application

Dependency inversion Mocking TypeMock Isolator DEMO 5 Testing an SharePoint application MVP Pattern Service Locator Pattern TypeMock Isolator API

Comparison Unit Integration System Speed Fast Medium Slow Mocking Every Some None Wrinting Hard Medium Easy Tradeoff between complexity and speed.

Approaches Big Bang Top-Down Button-Up Goals Independent Fast Reproducible

First thoughts New farm for each test 1 Reinstall script 2 VMware Snapshots Concerns: cumbersome and slow Mock SharePoint 1 Middle layer/sharepoint Repository 2 Mock all of the public API Concerns: huge project, won t run the real SharePoint logic

Using Typemock Isolator for Integration Tests 1 1 using ( var site = new SPSite (" http :// integration -test - site ") 2 { 3 Isolate. WhenCalled (()= > SPFarm. Local ). WillReturn ( 4 site. WebApplication. Farm ); 5 6 var context = SPContext. GetContext ( site ); 7 Isolate. WhenCalled (()= > SPContext. Current ). WillReturn ( context ); 8 9 // Arrange, Act, Assert 10 } What type of test is this? Problems? 1 http://blogs.msdn.com/francischeung/archive/2009/06/24/usingtypemock-isolator-for-integration-tests.aspx

SharePoint Integration Testing Making the Split:

SharePoint Integration Testing Making the Split: How does SharePoint find itself?

SharePoint Configuration Database

SharePoint Configuration Database 1 [ Guid ("3 B60B328 -F4D6-4902 - BEC6 - E904179FA246 ")] 2 public class SPPersistedObject :... 3 { 4 [ Persisted ] 5 private Hashtable m_properties ; 6...

SharePoint Configuration Database 1 [ Guid ("3 B60B328 -F4D6-4902 - BEC6 - E904179FA246 ")] 2 public class SPPersistedObject :... 3 { 4 [ Persisted ] 5 private Hashtable m_properties ; 6... 1 < Object Id=" 269080 da -0041-4 b34-917c -... " 2 ClassId =" 674 da553 -ea77-44 a3 -b9f8 -... " 3 ParentId =" 269080 da -0041-4 b34-917c -... " 4 Name =" TypeMock Farm "... > 5 < Properties > 6 < object type ="... SPFarm... "> 7... 8 <fld name =" m_properties " type =" null " / > 9... 10 </ object > 11 </ Properties > 12 </ Object >

Faking internal types 1 public static object Instance ( 2 this IFaker faker, 3 Type t, 4 Members behavior ) 5 { 6 var fakertype = typeof ( IFaker ); 7 var method = fakertype. GetMethod (" Instance ", 8 new [] { typeof ( Members ) }); 9 var genericmethod = method. MakeGenericMethod ( t); 10 return genericmethod. Invoke ( Isolate. Fake, 11 new object [] { behavior }); 12 }

Dynamic new behavior, interception 1 using TypeMock. Internal. Hooks ; 2 3 EventTunnel. ShouldInterceptDecision = ShouldInterceptDecision ; 4 EventTunnel. DuringMethodCall = DuringMethodCall ; 1 private static void ShouldInterceptDecision ( 2 TMShouldInterceptEventArgs eventargs ) 3 { 4 eventargs. Returns ( InterceptBehavior. LetIsolatorDecide ); 5 6 if ( eventargs. MethodName == ". ctor ") 7 { 8 eventargs. Returns ( InterceptBehavior. Intercept ); 9 } 10 }

Dynamic new behavior, swapping 1 private static void DuringMethodCall ( 2 TMDuringCallEventArgs eventargs ) 3 { 4 if ( eventargs. MethodName == ". ctor ") 5 { 6 DisableEventFiring (); 7 8 var obj =... // Mocked object 9 10 EnableEventFiring (); 11 12 Swap. CallsOn ( eventargs. Context ). WithCallsTo ( obj ); 13 14 eventargs. Returns ( IsolationBehavior. SkipMethod ); 15 } 16 }

DEMO 6 Testing an SharePoint application in-memory

DEMO 6 Testing an SharePoint application in-memory Can be easy if you got the right tools/frameworks

Current Status & Current status Can read most objects from the configuration database Found 3 bugs in TypeMock during development, none fixed The bugs prevent me from Update() and SPSite lookup (if I get time) Do Update() and SPSite lookup Model the content databases Mock the timer services? Mock the filesystem?

Pex - Automated White box Testing for.net Peli de Halleux and Nikolai Tillmann: Unit Testing SharePoint Services with Pex 2 2 http://research.microsoft.com/en-us/projects/pex/pexsharepoint.pdf

Pex - Automated White box Testing for.net Peli de Halleux and Nikolai Tillmann: Unit Testing SharePoint Services with Pex 2 Moles 1 MSPSite. NewString = ( site, _url ) => { 2 new MSPSite ( site ) { 3 OpenWeb = () => new MSPWeb () { 4 Dispose = () => { }, 5 ListsGet = () => new MSPListCollection () { 6 //... 7 }. Instance 8 }. Instance 9 }; 10 }; 2 http://research.microsoft.com/en-us/projects/pex/pexsharepoint.pdf

End Questions?