Table of Contents
Before you can do anything, you'll need to install Gallio & MbUnit, and if required configure it to your needs. In this chapter, we'll look at both installation and configuration.
To install Gallio and MbUnit v3, you'll need to visit gallio.org/downloads.aspx and download the version you need for your system. There are three options:
An installer for 64-bit systems
(GallioBundle-3.x.y.z-Setup-x64.msi)
An installer for 32-bit systems
(GallioBundle-3.x.y.z-Setup-x86.msi)
A zip file of the code for you to install as you will
(GallioBundle-3.x.y.z.zip)
A fourth option is to download the source code for Gallio from its Google Code project (http://code.google.com/p/mb-unit) and build it manually. You'll find instructions on how to do this in Part II, “Developing MbUnit and Gallio” .
Let's start by using the installer. Once you've downloaded the correct installer for your system, double-click it to start the installation. You'll soon see the start screen as shown in Figure 1.1, “Starting the Gallio Installer”.
Click . The second screen shows you that Gallio and MbUnit are licensed under the Apache Licence v2.0 and where to get a copy of it. For reference, you can find it at http://www.apache.org/licenses/LICENSE-2.0. Check the box accepting the terms of the agreement and then hit .
The third screen, shown in Figure 1.2, “Choosing Setup Type” offers three levels of setup option.
Clicking will show you all the possible options that can be installed as part of this setup. By default, those already selected are the options installed as part of the setup. Selecting all the options is the same as choosing the setup option.
The custom setup option, shown in Figure 1.3, “The Custom Setup Dialog” allows you to install only the elements of Gallio that you need for your system along with any documentation or samples you might need. In this section we'll run through the various options this custom setup allows you to pick.
We'll walk through them in order.
The first option, shown in Figure 1.4, “Choosing Gallio Options To Install”, installs the main Gallio automation framework and optionally the libraries that allow Gallio to interact with Visual Studio for debugging through tests and for navigating to source. You can also install:
A set of libraries that allow Gallio to work with the dynamic library runtime enabling use with IronPython.NET and IronRuby.NET , for example.
The second option, shown in Figure 1.5, “Choosing MbUnit v3 Options To Install”, installs the libraries for MbUnit v3. Optionally, you can also install
A set of project templates for Visual Studio that allow for easier set up of test projects with MbUnit v3.
One half of Gallio's flexibility comes from its ability to run tests written with any framework. All it needs is an adapter written to tell it how to run those tests and interpret the results. The third option, shown in Figure 1.6, “Choosing Test Framework Adapters To Install”, allows you to select from those adapters already written.
csUnit : Allows you to run csUnit tests with Gallio
MbUnit v2: Allows you to run MbUnit v2 tests with Gallio
MSTest: Allows you to run MSTest tests with Gallio (only if you have Visual Studio 2008 / Visual Studio Team System installed)
NUnit: Allows you to run NUnit tests with Gallio
RSpec: Allows you to run RSpec tests with Gallio
xUnit.NET: Allows you to run xUnit tests with Gallio
Note that unless you need to run tests created with these frameworks, you don't need to install these plugins.
The other half of Gallio's flexibility is its test runners. Runners are programs or plug-ins for other programs that provide different ways to run tests through Gallio. The fourth option, shown in Figure 1.7, “Choosing Test Runners To Install”, allows you to select which runners to install for other programs already installed on your machine. You have the choice of:
PowerShell commands: Allows you to run Gallio from a PowerShell script
ReSharper v4.5 plug-in: Allows you to run Gallio from ReSharper
Visual Studio 2008 Add-in: Allows you to run Gallio from Visual Studio's Team System
Icarus: Gallio's own graphical test runner
Echo: Gallio's own console test runner
MSBuild tasks: Allows you to run Gallio from an MSBuild build script
NAnt tasks: Allows you to run Gallio from a NAnt build script
TestDriven.NET runner: Allows you to run tests with Gallio from the TestDriven.NET Visual Studio add-in
Note that no matter how you choose to run Gallio, you will always be able to run tests written against any of the frameworks you have installed adapters for. For example, you'll be able to run csUnit tests through Resharper as long as you have installed the Resharper test runner and the csUnit framework adapter.
The fifth set of options, shown in Figure 1.8, “Choosing Test Tools To Install”, allows some integration between Gallio and other tools you have installed separately on your machine.
AutoCAD Integration: Allows tests that depend on the AutoCAD API ( ObjectARX ) to run inside the AutoCAD process.
Ambience: Ambience is Gallio's own utility for storing persistent data across multiple test runs. We'll look at using Ambience in Chapter 5, Testing Recipes 2
Browser Integration: Allows you to navigate directly from Gallio test reports to the source code the report is highlighting.
NCover integration: Allows you to enable code coverage with NCover by simply setting a property
TeamCity integration: Allows you to integrate Gallio reports into TeamCity .
TypeMock integration: Allows you to enable TypeMock.NET by simply setting a property
We'll look at the various ways that Gallio reports integrate into the browser and more in Chapter 7, Test Reports .
The Gallio installer also comes with a variety of documentation and code samples for your reference. Figure 1.9, “Choosing Documentation And Samples To Install” shows the options. You have the choice of:
Standalone Help Docs: Puts the standalone CHM documentation file on your system
Visual Studio Help Docs: Installs the integrated documentation for Visual Studio
Gallio Samples: Puts the (to be written) Gallio code samples on your system.
MbUnit Samples: Puts the MbUnit code samples on your system.
The samples and standalone documentation can be found at %programfiles%\Gallio\samples and %programfiles%\Gallio\docs for your use later on. The
samples are saved in zip files for you to extract yourself.
The final set of options, shown in Figure 1.10, “Choosing Extras To Install”, contain just one feature at the moment.
CruiseControl .Net extensions: Provides an extension to allow downloading attachment from the CCNet build report. It's only useful if you are implementing a build server.
The wizard is now ready to install your options. Click to have it run. If you ran the setup program as a standard user in Windows Vista or Windows 7, User Account Control will ask you for an administrator's account and password before installation begins. When everything is installed, the wizard lets you know.
Click to close the setup wizard. You'll find that the installer has created a folder in the Start Menu (Figure 1.11, “The Gallio Start Menu”, where you will see shortcuts for the , the , the , and the online documentation amongst others.
If you need access to the Gallio samples, docs and DLLs but don't want it registered on your system – for example, you just need the DLLs for source code check in or a build server – you can download a zipped archive of all the Gallio files instead of the standard MSI installer. If you visit gallio.org/downloads.aspx you'll find that each release has a zip file alternative for download as well.
The contents of the zip file, shown in Figure 1.12, “The Contents Of The Gallio Zip Download”,
mirror those installed to %programfiles%\Gallio by
the MSI installer.
Besides the root folder which contains the license files for the various pieces of software used by Gallio and shortcuts for the Gallio website, you'll find four folders.
The bin folder contains the main Gallio and
MbUnit v3 DLLs along with the Echo and Icarus test runner applications.
The various bin\xyz subfolders each contain
one of the test framework adapters, runners or tools mentioned earlier.
The bin\Resources subfolder also contains the
various files needed for the HTML and XML reports that Gallio builds after a test
run.
The docs folder contains the API
documentation for Gallio and MbUnit . It is available as a standalone .chm file, as
files for integration into Visual Studio help (and as Help 3 files – forthcoming). The
h2reg.exe program for integrating these files is in the
extras folder.
The extras folder contains the aforementioned
h2reg.exe program, project templates for Visual Studio
(2005/8/10) and files for incorporating Gallio into your CruiseControl.net build
server.
The samples folder contains a zip folder of
an example C# solution demonstrating various features in MbUnit v3. Once you've
extracted the solution, note that MbUnit.Samples.sln is a VS2005
file. MbUnit.Samples.2008.sln is for VS2008 users.