SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Ben Hall
Ben@BenHall.me.uk
Blog.BenHall.me.uk

TESTING YOUR APPLICATIONS
WITH MBUNIT
Who am I?
 Test Engineer @ Red Gate Software
 Based in Cambridge
 MbUnit Core Commit Member
 Actively involved with the project for past
  18-24 months
 NxtGenUG Member
 Blog.BenHall.me.uk
Agenda
 Unit Testing and Integration Testing
 Demo
   Tools and Frameworks
   Database Layer
   Business Layer
   User Interface
 MbUnit v3 and the Gallio Testing Platform
 Summary
Unit Testing

   Written by the developer
   Focus on happy day scenarios
   Ensures everything works as expected
   Support change of inner workings
   Support inexperience developers
   Code is less of a black box
   Manual testing is boring!
Integration Testing

We already have unit tests, why do we also
 need integration tests?

 Ideally written by a tester, however
  generally written by a developer.
 Unhappy scenarios
 End-To-End scenarios
 Does the code meet customer
  requirements
MbUnit 2.4

 www.MbUnit.com
 Advanced testing framework
 Open Source
 Developed a number of years ago by Peli
  (now works for Microsoft Research)
 Actively developed by a core team of 15
Tools and Frameworks
Demo

•MsTest
•NUnit
•MbUnit v2.4
•TestDriven.Net
•ReSharper
Scenario

 Core features of a e-commerce site
 Users can view products, search and place
  orders.
 Linq to SQL for database access
 ASP.net 2.0 for UI
 Web service for payment processing
Databases
Demo

•Testing Linq to SQL
•Transactions / RollBack
Business Layer
Demo

•Rhino Mocks to mock away from database
•Mocking external services
•RowTest
•Data Driven Tests
• MbUnit Asserts
•Custom Asserts
UI Testing

 Don’t Automate!
 At the moment its:
   Hard work
   Leads to fragile tests
   No ‘good’ solution
 There are solutions available...
WatiN - Web Application Testing
Demo

•Automate web application testing
•Supports Ajax
•Supports popups and logins.
•http://watin.sourceforge.net
UI Testing

 Model View Controller – MVC
  Ruby on Rails
  MonoRail
  ASP.net MVC
 Model View Presenter – MVP
  Difficult with WinForms/WPF
  No other UI framework?
ASP.net MVC
Code Demo

•Released ‘Shortly’
•CTP as part of ASP.net Futures
•Alternative to WebForms – Not a
replacement
•Designed for testability
MbUnit v3

 Alpha-1 release soon.
 Based on the Gallio Testing Platform.
 Goals
   Improved documentation and support
   Take testing to the next level
   Accommodate more testing styles.


 www.MbUnit.com
Gallio

 Gallio is an open, extensible, and neutral
  testing platform.
 Supports multiple .Net test frameworks
  including MbUnit, NUnit, NBehave, xUnit.Net
  and others.
 Share common components with community

 More information on the wiki
 http://code.google.com/p/mb-unit/
MbUnit v Nunit v MsTest v
XUnit
   Whatever works best for you....
   Nunit is simple and straightforward
   MbUnit is powerful and versatile
   MsTest – Don’t. Number of
    problems, 2008 has a number of
    improvements.
 Xunit – New boy. Some nice ideas...
Resources

 Books
   xUnit Test Patterns – Gerard Meszaros
   The Art of Unit Testing - Roy Osherove
 Blogs
   My blog - Blog.BenHall.me.uk
   CodeBetter.com
 Tools
     MbUnit – www.MbUnit.com
     TestDriven.Net – www.TestDriven.net
     Rhino Mocks – www.Ayende.com
     TypeMock – www.TypeMock.com
     WatiN – http://watin.sourceforge.net
Summary

 Keep things simple
 Keep things small
 Abstraction is key
 ASP.net MVC is the future!
 MbUnit v3 and Gallio are coming soon.


 Thank you!
 Slides + Code on my blog Blog.BenHall.me.uk
Questions

Weitere ähnliche Inhalte

Was ist angesagt?

Unit testing
Unit testingUnit testing
Unit testing
Brian Hu
 
BSides 2015 Intro to Web App Pen Testing with Mutillidae
BSides 2015 Intro to Web App Pen Testing with MutillidaeBSides 2015 Intro to Web App Pen Testing with Mutillidae
BSides 2015 Intro to Web App Pen Testing with Mutillidae
andrew242
 

Was ist angesagt? (15)

Fun with ASP.NET MVC 3, MEF and NuGet
Fun with ASP.NET MVC 3, MEF and NuGetFun with ASP.NET MVC 3, MEF and NuGet
Fun with ASP.NET MVC 3, MEF and NuGet
 
Zero cost serverless Real time web app
Zero cost serverless Real time web appZero cost serverless Real time web app
Zero cost serverless Real time web app
 
Unit testing
Unit testingUnit testing
Unit testing
 
Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015
 
That worked before
That worked beforeThat worked before
That worked before
 
Automated testing of audio video feature in web application
Automated testing of audio video feature in web applicationAutomated testing of audio video feature in web application
Automated testing of audio video feature in web application
 
The state of Jenkins pipelines or do I still need freestyle jobs
The state of Jenkins pipelines or do I still need freestyle jobsThe state of Jenkins pipelines or do I still need freestyle jobs
The state of Jenkins pipelines or do I still need freestyle jobs
 
Enterprise PHP (Zend UK Business Conference)
Enterprise PHP (Zend UK Business Conference)Enterprise PHP (Zend UK Business Conference)
Enterprise PHP (Zend UK Business Conference)
 
Lightning talk how to edit the Silverstripe CMS docs
Lightning talk how to edit the Silverstripe CMS docsLightning talk how to edit the Silverstripe CMS docs
Lightning talk how to edit the Silverstripe CMS docs
 
Windows phone 7 part iii
Windows phone 7 part iiiWindows phone 7 part iii
Windows phone 7 part iii
 
Windows phone 7 part iv
Windows phone 7 part ivWindows phone 7 part iv
Windows phone 7 part iv
 
Open NTF OpenSource is collaboration at its best and matters
Open NTF OpenSource is collaboration at its best and mattersOpen NTF OpenSource is collaboration at its best and matters
Open NTF OpenSource is collaboration at its best and matters
 
BSides 2015 Intro to Web App Pen Testing with Mutillidae
BSides 2015 Intro to Web App Pen Testing with MutillidaeBSides 2015 Intro to Web App Pen Testing with Mutillidae
BSides 2015 Intro to Web App Pen Testing with Mutillidae
 
Jenkins and visual regression – Exove
Jenkins and visual regression – ExoveJenkins and visual regression – Exove
Jenkins and visual regression – Exove
 
Andrii Shumada "No excuses for not writing tests"
Andrii Shumada "No excuses for not writing tests"Andrii Shumada "No excuses for not writing tests"
Andrii Shumada "No excuses for not writing tests"
 

Andere mochten auch

VauhkonenVohraMadaan-ProjectDeepLearningBenchMarks
VauhkonenVohraMadaan-ProjectDeepLearningBenchMarksVauhkonenVohraMadaan-ProjectDeepLearningBenchMarks
VauhkonenVohraMadaan-ProjectDeepLearningBenchMarks
Mumtaz Hannah Vauhkonen
 
Cap04 el consumidor cuc_2012 (1)
Cap04 el consumidor cuc_2012 (1)Cap04 el consumidor cuc_2012 (1)
Cap04 el consumidor cuc_2012 (1)
Carmen Hevia Medina
 
Hip hop y desarrollo
Hip hop y desarrolloHip hop y desarrollo
Hip hop y desarrollo
sorrowize
 
Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011
Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011
Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011
cletachira
 

Andere mochten auch (20)

Net2Vic: Subject, opens, clicks - oh my! An email discussion panel
Net2Vic:  Subject, opens, clicks - oh my! An email discussion panelNet2Vic:  Subject, opens, clicks - oh my! An email discussion panel
Net2Vic: Subject, opens, clicks - oh my! An email discussion panel
 
Medioymedio
MedioymedioMedioymedio
Medioymedio
 
The Global Economy No. 2 - February 16, 2012
The Global Economy No. 2 -  February 16, 2012The Global Economy No. 2 -  February 16, 2012
The Global Economy No. 2 - February 16, 2012
 
HV: YULIET CARMONA
HV: YULIET CARMONAHV: YULIET CARMONA
HV: YULIET CARMONA
 
Introduccion
IntroduccionIntroduccion
Introduccion
 
VauhkonenVohraMadaan-ProjectDeepLearningBenchMarks
VauhkonenVohraMadaan-ProjectDeepLearningBenchMarksVauhkonenVohraMadaan-ProjectDeepLearningBenchMarks
VauhkonenVohraMadaan-ProjectDeepLearningBenchMarks
 
Paperfox kiadvany 2014_web_interactive_medium
Paperfox kiadvany 2014_web_interactive_mediumPaperfox kiadvany 2014_web_interactive_medium
Paperfox kiadvany 2014_web_interactive_medium
 
Sitios blindados de SharePoint
Sitios blindados de SharePointSitios blindados de SharePoint
Sitios blindados de SharePoint
 
Valores vectorespropios-productointerno-cuadraticas
Valores vectorespropios-productointerno-cuadraticasValores vectorespropios-productointerno-cuadraticas
Valores vectorespropios-productointerno-cuadraticas
 
Allot Optenet Parental Control: Solution Brief
Allot Optenet Parental Control: Solution BriefAllot Optenet Parental Control: Solution Brief
Allot Optenet Parental Control: Solution Brief
 
Net Solutions Drupal Development Brochure
Net Solutions Drupal Development BrochureNet Solutions Drupal Development Brochure
Net Solutions Drupal Development Brochure
 
Islamic way of worship week 1,2 & 3
Islamic way of worship week 1,2 & 3Islamic way of worship week 1,2 & 3
Islamic way of worship week 1,2 & 3
 
Cap04 el consumidor cuc_2012 (1)
Cap04 el consumidor cuc_2012 (1)Cap04 el consumidor cuc_2012 (1)
Cap04 el consumidor cuc_2012 (1)
 
Hip hop y desarrollo
Hip hop y desarrolloHip hop y desarrollo
Hip hop y desarrollo
 
Allef mobi iş fırsat sunumu
Allef mobi iş fırsat sunumuAllef mobi iş fırsat sunumu
Allef mobi iş fırsat sunumu
 
Fiskalni program pos sector
Fiskalni program pos sectorFiskalni program pos sector
Fiskalni program pos sector
 
DealerLink Demo
DealerLink DemoDealerLink Demo
DealerLink Demo
 
Guía de Magazine Factory
Guía de Magazine FactoryGuía de Magazine Factory
Guía de Magazine Factory
 
Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011
Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011
Informe Dirección de Consultoría Jurídica CLET I Trimestre 2011
 
Odisha agriculture policy 2013 guideline for subsidy for finance, subsidy &...
Odisha agriculture policy 2013 guideline for subsidy   for finance, subsidy &...Odisha agriculture policy 2013 guideline for subsidy   for finance, subsidy &...
Odisha agriculture policy 2013 guideline for subsidy for finance, subsidy &...
 

Ähnlich wie Testing your applications with mbunit

FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...
FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...
FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...
WSPDC & FEDSPUG
 
Arm html5 presentation
Arm html5 presentationArm html5 presentation
Arm html5 presentation
Ian Renyard
 
Deepak_Resume_Automation
Deepak_Resume_AutomationDeepak_Resume_Automation
Deepak_Resume_Automation
Deepak Pandey
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
CIVEL Benoit
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh Dahal
QA or the Highway
 

Ähnlich wie Testing your applications with mbunit (20)

MockServer-driven testing
MockServer-driven testingMockServer-driven testing
MockServer-driven testing
 
Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
 
Mayur_Resume (2) (1)
Mayur_Resume (2) (1)Mayur_Resume (2) (1)
Mayur_Resume (2) (1)
 
FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...
FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...
FEDSPUG April 2014: Visual Studio 2013 for Application Lifecycle Management &...
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
 
Practicing Agile in Offshore Environment by Himanshu Seth & Imran Mir
Practicing Agile in Offshore Environment by Himanshu Seth & Imran MirPracticing Agile in Offshore Environment by Himanshu Seth & Imran Mir
Practicing Agile in Offshore Environment by Himanshu Seth & Imran Mir
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
LvivCSS: Web Components as a foundation for Design System
LvivCSS: Web Components as a foundation for Design SystemLvivCSS: Web Components as a foundation for Design System
LvivCSS: Web Components as a foundation for Design System
 
QAorHighway2016
QAorHighway2016QAorHighway2016
QAorHighway2016
 
Manoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration TestingManoj kolhe - Continuous Integration Testing
Manoj kolhe - Continuous Integration Testing
 
Test automation proposal
Test automation proposalTest automation proposal
Test automation proposal
 
Arm html5 presentation
Arm html5 presentationArm html5 presentation
Arm html5 presentation
 
Deepak_Resume_Automation
Deepak_Resume_AutomationDeepak_Resume_Automation
Deepak_Resume_Automation
 
Accessibility Testing - Using Asqatasun - Meetup Webinar
Accessibility Testing - Using Asqatasun - Meetup WebinarAccessibility Testing - Using Asqatasun - Meetup Webinar
Accessibility Testing - Using Asqatasun - Meetup Webinar
 
Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)Cerberus : Framework for Manual and Automated Testing (Web Application)
Cerberus : Framework for Manual and Automated Testing (Web Application)
 
Cerberus_Presentation1
Cerberus_Presentation1Cerberus_Presentation1
Cerberus_Presentation1
 
Testwarez 2009 Use Proper Tool
Testwarez 2009 Use Proper ToolTestwarez 2009 Use Proper Tool
Testwarez 2009 Use Proper Tool
 
Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015Agile Engineering Sparker GLASScon 2015
Agile Engineering Sparker GLASScon 2015
 
Test Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh DahalTest Automation Architecture That Works by Bhupesh Dahal
Test Automation Architecture That Works by Bhupesh Dahal
 
Continuous Integration: A Case Study
Continuous Integration: A Case StudyContinuous Integration: A Case Study
Continuous Integration: A Case Study
 

Mehr von Ben Hall

Mehr von Ben Hall (20)

The Art Of Documentation - NDC Porto 2022
The Art Of Documentation - NDC Porto 2022The Art Of Documentation - NDC Porto 2022
The Art Of Documentation - NDC Porto 2022
 
The Art Of Documentation for Open Source Projects
The Art Of Documentation for Open Source ProjectsThe Art Of Documentation for Open Source Projects
The Art Of Documentation for Open Source Projects
 
Three Years of Lessons Running Potentially Malicious Code Inside Containers
Three Years of Lessons Running Potentially Malicious Code Inside ContainersThree Years of Lessons Running Potentially Malicious Code Inside Containers
Three Years of Lessons Running Potentially Malicious Code Inside Containers
 
Containers without docker
Containers without dockerContainers without docker
Containers without docker
 
Deploying windows containers with kubernetes
Deploying windows containers with kubernetesDeploying windows containers with kubernetes
Deploying windows containers with kubernetes
 
The Art of Documentation and Readme.md for Open Source Projects
The Art of Documentation and Readme.md for Open Source ProjectsThe Art of Documentation and Readme.md for Open Source Projects
The Art of Documentation and Readme.md for Open Source Projects
 
How Secure Are Docker Containers?
How Secure Are Docker Containers?How Secure Are Docker Containers?
How Secure Are Docker Containers?
 
The Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud NativeThe Challenges of Becoming Cloud Native
The Challenges of Becoming Cloud Native
 
Scaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container ServiceScaling Docker Containers using Kubernetes and Azure Container Service
Scaling Docker Containers using Kubernetes and Azure Container Service
 
The art of documentation and readme.md
The art of documentation and readme.mdThe art of documentation and readme.md
The art of documentation and readme.md
 
Experimenting and Learning Kubernetes and Tensorflow
Experimenting and Learning Kubernetes and TensorflowExperimenting and Learning Kubernetes and Tensorflow
Experimenting and Learning Kubernetes and Tensorflow
 
Running .NET on Docker
Running .NET on DockerRunning .NET on Docker
Running .NET on Docker
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with KubernetesTips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
Tips on solving E_TOO_MANY_THINGS_TO_LEARN with Kubernetes
 
Deploying applications to Windows Server 2016 and Windows Containers
Deploying applications to Windows Server 2016 and Windows ContainersDeploying applications to Windows Server 2016 and Windows Containers
Deploying applications to Windows Server 2016 and Windows Containers
 
The How and Why of Windows containers
The How and Why of Windows containersThe How and Why of Windows containers
The How and Why of Windows containers
 
Lessons from running potentially malicious code inside containers
Lessons from running potentially malicious code inside containersLessons from running potentially malicious code inside containers
Lessons from running potentially malicious code inside containers
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
Learning Patterns for the Overworked Developer
Learning Patterns for the Overworked DeveloperLearning Patterns for the Overworked Developer
Learning Patterns for the Overworked Developer
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 

Kürzlich hochgeladen

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

Kürzlich hochgeladen (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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...
 
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...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 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)
 
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
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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
 

Testing your applications with mbunit

  • 2. Who am I?  Test Engineer @ Red Gate Software  Based in Cambridge  MbUnit Core Commit Member  Actively involved with the project for past 18-24 months  NxtGenUG Member  Blog.BenHall.me.uk
  • 3. Agenda  Unit Testing and Integration Testing  Demo  Tools and Frameworks  Database Layer  Business Layer  User Interface  MbUnit v3 and the Gallio Testing Platform  Summary
  • 4. Unit Testing  Written by the developer  Focus on happy day scenarios  Ensures everything works as expected  Support change of inner workings  Support inexperience developers  Code is less of a black box  Manual testing is boring!
  • 5. Integration Testing We already have unit tests, why do we also need integration tests?  Ideally written by a tester, however generally written by a developer.  Unhappy scenarios  End-To-End scenarios  Does the code meet customer requirements
  • 6. MbUnit 2.4  www.MbUnit.com  Advanced testing framework  Open Source  Developed a number of years ago by Peli (now works for Microsoft Research)  Actively developed by a core team of 15
  • 7. Tools and Frameworks Demo •MsTest •NUnit •MbUnit v2.4 •TestDriven.Net •ReSharper
  • 8. Scenario  Core features of a e-commerce site  Users can view products, search and place orders.  Linq to SQL for database access  ASP.net 2.0 for UI  Web service for payment processing
  • 9. Databases Demo •Testing Linq to SQL •Transactions / RollBack
  • 10. Business Layer Demo •Rhino Mocks to mock away from database •Mocking external services •RowTest •Data Driven Tests • MbUnit Asserts •Custom Asserts
  • 11. UI Testing  Don’t Automate!  At the moment its:  Hard work  Leads to fragile tests  No ‘good’ solution  There are solutions available...
  • 12. WatiN - Web Application Testing Demo •Automate web application testing •Supports Ajax •Supports popups and logins. •http://watin.sourceforge.net
  • 13. UI Testing  Model View Controller – MVC  Ruby on Rails  MonoRail  ASP.net MVC  Model View Presenter – MVP  Difficult with WinForms/WPF  No other UI framework?
  • 14. ASP.net MVC Code Demo •Released ‘Shortly’ •CTP as part of ASP.net Futures •Alternative to WebForms – Not a replacement •Designed for testability
  • 15. MbUnit v3  Alpha-1 release soon.  Based on the Gallio Testing Platform.  Goals  Improved documentation and support  Take testing to the next level  Accommodate more testing styles.  www.MbUnit.com
  • 16. Gallio  Gallio is an open, extensible, and neutral testing platform.  Supports multiple .Net test frameworks including MbUnit, NUnit, NBehave, xUnit.Net and others.  Share common components with community  More information on the wiki  http://code.google.com/p/mb-unit/
  • 17. MbUnit v Nunit v MsTest v XUnit  Whatever works best for you....  Nunit is simple and straightforward  MbUnit is powerful and versatile  MsTest – Don’t. Number of problems, 2008 has a number of improvements.  Xunit – New boy. Some nice ideas...
  • 18. Resources  Books  xUnit Test Patterns – Gerard Meszaros  The Art of Unit Testing - Roy Osherove  Blogs  My blog - Blog.BenHall.me.uk  CodeBetter.com  Tools  MbUnit – www.MbUnit.com  TestDriven.Net – www.TestDriven.net  Rhino Mocks – www.Ayende.com  TypeMock – www.TypeMock.com  WatiN – http://watin.sourceforge.net
  • 19. Summary  Keep things simple  Keep things small  Abstraction is key  ASP.net MVC is the future!  MbUnit v3 and Gallio are coming soon.  Thank you!  Slides + Code on my blog Blog.BenHall.me.uk

Hinweis der Redaktion

  1. 2 (2mins)Talk won’t be just on MbUnit, I will be touching on other tools such as Rhino Mocks which help improve testing. Find out how many people are unit testing at the moment? Who are using MbUnit?
  2. 7 (5mins)
  3. 10 (3mins)
  4. 15 (5mins)Sample\\SampleShort demo, covers what is the same with the three frameworks. How they can be executed, some of the cool tools to help. How Resharper can help when developing. Quick and too the point, make sure everyone is up to speed for the rest of the content.DemostrateMSTest, explain how it needs meta data and saves the results in TestResults.DemostrateNunit, show the asserts, how they are different from MSTest. Show how to run the tests using TD.net and ReSharper, show failing tests, Show Nunit UI. DemostrateMbUnit, show the assertions, show migrating from Nunit, show UI.Explain test layout, test naming, show ReSharper method template,
  5. 16 (1min)Show final application to show the end result so everything has a good idea where we are heading.
  6. 24 (8mins)Problems with Rollback/TransactionsNeed to ensure that you have a well known state for the database (demonstrate what happens if you don’t. Fragile tests).InternalsVisibleTo()ExplainLinq to SQL and each Repository (say why I have split it – to isolate and make tests more targetted).Explain that we use repositories so we can mock them as the DataContext cannot be mocked.Explain TestHelper (and Tests)InternalsVisibleTo() to hide some implementation but still have it tested. Hitting the database isn’t bad (just slow), the problems associated with databases is bad. Use TransactionsUse Rollback to make tests easierProblems with Rollback (Auto increment)Solution is DBCC (if auto increment is important to you) – Extract it into external script if you wish.
  7. 34 (10mins)Explain Mock ObjectsExplain why they are useful with external services (Payment)(ProductControllerTests)Refactor tests to include validation as that is also important to test. RowTest to enable range testing.Other\\DataDrivenTestsDemonstrate how it could be used. Show the class browser for MbUnit.FrameworkvsNunit to explain the different assertions we have. CustomerControllerTestsHowever, none meet our require. CustomAssert.AreEqual
  8. 36 (2mins)
  9. 40 (6mins)Show sample WatiN site, explain how it all works. Explain problems with UAC.
  10. 42 (2mins)
  11. 48 (4mins)ScottHa’sBlogEngine Code.Can’t be demo’ed as it won’t have been released.Explain how it all links together.View is very thin.
  12. 50 (2mins)
  13. 52 (2mins)
  14. 57 (5mins)
  15. 58 (1min)
  16. 60 (2min)
  17. Only if my timings are really out.