Pex – automatisch ‘white box’ testing for .NET
1 van de heel lastige dingen in SharePoint is het schrijven van goede unit testen. Hoe schrijf je bijvoorbeeld een unit test voor een eventhandler?
Microsoft Research heeft hier tools voor geschreven om dit toch mogelijk te maken.
Een aantal zaken doen ze voor je. Automatisch Mocks voor alle SharePoint objecten maken. Daarnaast checken ze aan de hand van je code welke unit tests je allemaal zou moeten hebben. Daar komen uitermate veel verrassende randvoorwaarden uit waar je zelf altijd vergeet te testen (null variabele, verkeerde object types etc).
Hier vindt je meer informatie (Ik ben niet zo’n super developer dus sommige dingen zijn voor mij te complex ;))
Wat gaaf is, Peli de Halleux komt in Amsterdam vertellen hoe dit precies werkt tijdens de Microsoft SharePoint Connections 2010 in de Rai 18 en 19 januari. Met wat geluk net de tijd om nog wat leuke aankondigingen te doen rondom dit topic.
MSC26: Pex —Unit Testing of SharePoint Services that Rocks!
Peli de Halleux
SharePoint Services are challenging for unit testing because it is not possible to execute the SharePoint Service without being connected to a live SharePoint site. For that reason, most of the unit tests written for SharePoint are actually integration tests as they need a live system to run. In this session, we show how to use Pex, an automated test generation tool for .NET, to test SharePoint Services in isolation. From a parameterized unit test, Pex generates a suite of closed unit tests with high code coverage. Pex also contains a stubbing framework, Moles, that allows to detour any .NET method to user-defined delegates, e.g., replace any call to the SharePoint Object Model by a user-defined delegate.
Dus ben je een ‘echte’ developer dan is dit wel een super onderwerp om je in te verdiepen.