SlideShare a Scribd company logo
Silverlight 2 Unit Testing Andre John Cruz MVP – Visual C#
Silverlight 2 Up-coming version of the Silverlight browser plugin with a mini version of the .NET Framework Richer functionality than Silverlight 1.0 Currently in beta
Unit Testing Testing a specific portion or unit of a system Can mean different things to different people Unit = Small Automated  unit testing: Test-first (TDD) Test-after
Why Unit Test? Illustration:
Automated Unit Testing Usually with a tool like NUnit or MSTest Silverlight presents new challenges Silverlight 2 code runs in the browser (client) UI testing is usually tricky
Silverlight 2 Testing Framework Adaptation of MSTest for Silverlight 2! Browser-based unit test runner Capability to do UI testing
How? Download Silverlight 2 beta 1, and Visual Studio 2008 Tools for Silverlight 2  Silverlight Testing Framework is included in the source code for Silverlight controls!
How? (part 2) Download the Silverlight test templates from  www.jeff.wilcox.name   Ensure you have these DLLs Microsoft.Silverlight.Testing.dll Microsoft.Silverlight.Testing.Framework.dll Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll Mark your test class with the [TestClass] attribute and your test methods with [TestMethod]
Testing Framework Demo…
UI Testing Strategies Separation of concerns Don’t  put everything in code behind! Small steps You can make use of patterns such as Model-View-Presenter (MVP) You can also add controls to the “testing surface” and assert against their properties
Examples Adding controls to the testing surface Steps: Reference the app/control library in your test project Derive your test class from the SilverlightTest class Add your control to the TestSurface Testing surface gets cleared before every test method run
Examples Adding controls to the testing surface Observations: Very helpful  to use the [assembly:InternalsVisibleTo] attribute Use “internal” methods instead of “private” for your event handlers so you can force-trigger them from your tests
Examples Use of Model-View-Presenter pattern Very well-suited to view-centric frameworks such as Windows Forms and Silverlight/WPF Allow you to test view logic without having a view ;)
Future Directions Silverlight 2, Testing Framework still in beta! ScottGu mentioned… Possible UI Automation API (e.g. simulate mouse/keyboard actions in code) This is more appropriately called “integration testing” Tighter integration into VS 2008 IDE
Thank You! Resources: ScottGu’s  wonderful  blog http://www.jeff.wilcox.name http://silverlight.net Personal blog: http://devpinoy.org/blogs/cruizer [email_address]

More Related Content

ODP
Software testing tools
PDF
Open Source Software Testing Tools
PPTX
Types of test tools
PDF
Software testing tools
PPTX
Test complete, work done so far
PPTX
Automation Testing with Test Complete
PPT
Demo1ghjkl
PPT
Software Testing - Tool support for testing (CAST) - Mazenet Solution
Software testing tools
Open Source Software Testing Tools
Types of test tools
Software testing tools
Test complete, work done so far
Automation Testing with Test Complete
Demo1ghjkl
Software Testing - Tool support for testing (CAST) - Mazenet Solution

What's hot (19)

PDF
Testing Tool Evaluation Criteria
PPT
Testing_with_TestComplete
PPTX
Software testing tools (free and open source)
PPTX
OPASS - Microsoft Test Manager
PDF
Testing Tools
PDF
Top ten software testing tools
PDF
Software Testing Tools | Edureka
PPTX
The Amazing Bug Story
PDF
Magento's MFTF for Agencies and Extension Developers
ODP
Selenium ppt
PPTX
TestComplete – A Sophisticated Automated Testing Tool by SmartBear
PPTX
Silk Performer Presentation v1
PPTX
Best java automation training institute in Bangalore - Selenium Labs
PPSX
Test Complete
PDF
Introduction to testlink
PPT
Continuous Integration: A Case Study
PPT
UIAutomation_Testing
PPTX
STARWEST 2011 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
PPTX
Unit testing with visual studio 2012
Testing Tool Evaluation Criteria
Testing_with_TestComplete
Software testing tools (free and open source)
OPASS - Microsoft Test Manager
Testing Tools
Top ten software testing tools
Software Testing Tools | Edureka
The Amazing Bug Story
Magento's MFTF for Agencies and Extension Developers
Selenium ppt
TestComplete – A Sophisticated Automated Testing Tool by SmartBear
Silk Performer Presentation v1
Best java automation training institute in Bangalore - Selenium Labs
Test Complete
Introduction to testlink
Continuous Integration: A Case Study
UIAutomation_Testing
STARWEST 2011 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
Unit testing with visual studio 2012
Ad

Similar to Silverlight2 Unit Testing Slides (20)

PPT
Microsoft Silverlight
PPTX
An overview of moonlight applications test automation
PPT
Silverlight 2 for Developers - TechEd New Zealand 2008
PPT
Automated Unit Testing in Silverlight for Windows Phone 7
PPTX
Getting Started with Coded UI Testing: Building Your First Automated Test
PPTX
Parallel minds silverlight
PPTX
Getting Started with Visual Studio’s Coded UI Testing: Building Your First Au...
PPTX
Introduction to JQuery, ASP.NET MVC and Silverlight
PPTX
Modern ASP.NET Webskills
PDF
Getting Started With Coded UI testing: Building Your First Automated Test
PPT
Web311 Designing Compelling Silverlight User Experiences With Expression St...
PPTX
Silverlight
PPT
Silverlight
PDF
Building Rich Internet Apps with Silverlight 2
PPTX
Automated Testing Of EPiServer CMS Sites
PPTX
Coding Naked
PPTX
Testing the User Interface - Coded UI Tests with Visual Studio 2010
PPTX
HDC 2010 - Creating Quality Software: A Look at Visual Studio 2010 Testing Tools
PPTX
Introduction to silverlight
PPTX
Introduction to silverlight control 4
Microsoft Silverlight
An overview of moonlight applications test automation
Silverlight 2 for Developers - TechEd New Zealand 2008
Automated Unit Testing in Silverlight for Windows Phone 7
Getting Started with Coded UI Testing: Building Your First Automated Test
Parallel minds silverlight
Getting Started with Visual Studio’s Coded UI Testing: Building Your First Au...
Introduction to JQuery, ASP.NET MVC and Silverlight
Modern ASP.NET Webskills
Getting Started With Coded UI testing: Building Your First Automated Test
Web311 Designing Compelling Silverlight User Experiences With Expression St...
Silverlight
Silverlight
Building Rich Internet Apps with Silverlight 2
Automated Testing Of EPiServer CMS Sites
Coding Naked
Testing the User Interface - Coded UI Tests with Visual Studio 2010
HDC 2010 - Creating Quality Software: A Look at Visual Studio 2010 Testing Tools
Introduction to silverlight
Introduction to silverlight control 4
Ad

Recently uploaded (20)

PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Machine learning based COVID-19 study performance prediction
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Cloud computing and distributed systems.
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Electronic commerce courselecture one. Pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
cuic standard and advanced reporting.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Building Integrated photovoltaic BIPV_UPV.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
NewMind AI Weekly Chronicles - August'25 Week I
Machine learning based COVID-19 study performance prediction
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Cloud computing and distributed systems.
Dropbox Q2 2025 Financial Results & Investor Presentation
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
Electronic commerce courselecture one. Pdf
Advanced methodologies resolving dimensionality complications for autism neur...
cuic standard and advanced reporting.pdf

Silverlight2 Unit Testing Slides

  • 1. Silverlight 2 Unit Testing Andre John Cruz MVP – Visual C#
  • 2. Silverlight 2 Up-coming version of the Silverlight browser plugin with a mini version of the .NET Framework Richer functionality than Silverlight 1.0 Currently in beta
  • 3. Unit Testing Testing a specific portion or unit of a system Can mean different things to different people Unit = Small Automated unit testing: Test-first (TDD) Test-after
  • 4. Why Unit Test? Illustration:
  • 5. Automated Unit Testing Usually with a tool like NUnit or MSTest Silverlight presents new challenges Silverlight 2 code runs in the browser (client) UI testing is usually tricky
  • 6. Silverlight 2 Testing Framework Adaptation of MSTest for Silverlight 2! Browser-based unit test runner Capability to do UI testing
  • 7. How? Download Silverlight 2 beta 1, and Visual Studio 2008 Tools for Silverlight 2 Silverlight Testing Framework is included in the source code for Silverlight controls!
  • 8. How? (part 2) Download the Silverlight test templates from www.jeff.wilcox.name Ensure you have these DLLs Microsoft.Silverlight.Testing.dll Microsoft.Silverlight.Testing.Framework.dll Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll Mark your test class with the [TestClass] attribute and your test methods with [TestMethod]
  • 10. UI Testing Strategies Separation of concerns Don’t put everything in code behind! Small steps You can make use of patterns such as Model-View-Presenter (MVP) You can also add controls to the “testing surface” and assert against their properties
  • 11. Examples Adding controls to the testing surface Steps: Reference the app/control library in your test project Derive your test class from the SilverlightTest class Add your control to the TestSurface Testing surface gets cleared before every test method run
  • 12. Examples Adding controls to the testing surface Observations: Very helpful to use the [assembly:InternalsVisibleTo] attribute Use “internal” methods instead of “private” for your event handlers so you can force-trigger them from your tests
  • 13. Examples Use of Model-View-Presenter pattern Very well-suited to view-centric frameworks such as Windows Forms and Silverlight/WPF Allow you to test view logic without having a view ;)
  • 14. Future Directions Silverlight 2, Testing Framework still in beta! ScottGu mentioned… Possible UI Automation API (e.g. simulate mouse/keyboard actions in code) This is more appropriately called “integration testing” Tighter integration into VS 2008 IDE
  • 15. Thank You! Resources: ScottGu’s wonderful blog http://www.jeff.wilcox.name http://silverlight.net Personal blog: http://devpinoy.org/blogs/cruizer [email_address]