7 jours d'essai offerts
Cet ouvrage et des milliers d'autres sont disponibles en abonnement pour 8,99€/mois

Compartir esta publicación

Core Technology
by Pablo Santos and Francisco J. Garcia
DistributedUnitTestingSupporting multiple platforms accuratelyand efficientlyAt Codice Software we design and develop software configuration management tools that runon various combinations of operating systems and hardware platforms. For instance, both serv-er and clients run on Windows XP/2000/2003/Vista, Linux, and Mac OS X. And since our soft-ware uses .NET, it runs on native Microsoft implementation for Windows and Mono for UNIX-like operating systems.There’s only one way to accurately the testing process. The key to our distributed testing solution isPCaobdlicoe  iSs oaf tSwoaftrew. aHree  cEangibneeer atand efficiently support platform com- PNUnit, short for “Parallel NUnit.” PNUnit is a modified version ofreached at nbinations such as these—testing, and the familiar NUnit (www.nunit.org) testing framework that waspsantosl@codicesoftware.com.lots of it. However, running a software originally ported from JUnit to .NET. The source code and relatedFranciscois a Professor ofpackage on 36 platform combina- files for PNUnit are available electronically; see “Resource Center,”CUonimvperustietry  Socf iSeanlcae mata tnhcea. Youtions, release after release, is a page 5.can reach him atHerculean effort. The solution we We were already using NUnit to develop unit tests because ourfgarcia@usal.esadopted was to distribute testing tasks development is .NET based. NUnit lets you write unit tests with allby running them in parallel. In addi- .NET languages, and even adhere to test-driven development princi-tion to uncovering bugs, this ples. Still, our primary concern was testing on multiple platformsapproach significantly speeded up using distributed test scenarios. Unfortunately, stock NUnit doesn’tsupport this, hence our decision to extend NUnit to support distrib-uted testing.One of the reasons we wanted to stick with the NUnit framework isthat we were familiar with its environment. Usually when you move toa new testing platform, the first thing you have to do is learn a newscripting language. By extending NUnit, we could use the same pro-gramming language and constructions (test suites, fixtures, and thelike) that we were used to with regular unit testing.Developing Automated Tests with PNUnitFigure 1 shows the basic structure and main components of thePNUnit system. Launcher is the program responsible for launchingtest suites on test machines. It is called by a test configuration fileas an argument, reads the file, and sends instructions to the testingmachines. It then gathers test results and prints them on thescreen. The test configuration (testconf) file is written in XML andcontains a definition of the test scenario being created. It defines
IPNUnitServicesRunner
IPNUnitAgentPNUnitAgentLauncher.exe
TestAssembly
Agent.exeFigure 1:PNUnit high-level structure.28Dr. Dobb’s Journallwww.ddj.comlNovember 2006
PNUnitTestRunner