Dashboard > GreenPepper Open Documentation Refactoring > ... > MSBuild plugin > Full MSBuild plugin guide - HTML
  GreenPepper Open Documentation Refactoring Log In View a printable version of the current page.  
  Full MSBuild plugin guide - HTML
Added by Laurent Cobos, last edited by Laurent Cobos on Aug 13, 2009
Labels: 
(None)

Full MSBuild plugin guide

MSBuild is the Microsoft .NET build tool software for automating software build processes. It is similar to NAnt.

1. Install MSBuild plugin

Be Careful

Available since GreenPepper 2.5.1

The MSBuild tasks are used during the Integration test phase of the build life cycle to execute the specifications of an application. They generate reports in plain HTML file format (*.html). By default, these files are generated in the build file directory.

There are two MSBuild tasks :

  • <GreenPepperTask>: Executes the specifications and generates reports
  • <FreezeTask>: Downloads the specifications locally

    To use the MSBuild Tasks for GreenPepper, you must load task extensions assembly: GreenPepper.Extensions.dll
    To do so, you have to indicate in your MSBuild project file :
    For GreenPepperTask
    <UsingTask TaskName="GreenPepper.MSBuild.GreenPepperTask" AssemblyFile="GreenPepper.Extensions.dll"/>
    
    For FreezeTask
    <UsingTask TaskName="GreenPepper.MSBuild.FreezeTask" AssemblyFile="GreenPepper.Extensions.dll"/>
    

2. Use

<GreenPepperTask>

MSBuild task that executes specifications.

Parameters

Attribute Type Description Required
Input string The specification to use as input, for a suite this is the GreenPepper UID that you can find in your GreenPeppper Confluence's Space Registration page True
Repository ITaskItem The repository to fetch specifications from True
Output string The path to produce reports (defaults to current directory) False
OutputType string The output type of report (defaults to plain) False
Suite bool It runs a suite rather than a single test (output must refer to a directory). Default value is false False
Appconfig string The application configuration file to use for the GreenPepper test domain. If none specified, will try all assemblies to see if there is a corresponding .config (only the first one will be use) False
SystemUnderDevelopment ITaskItem The system under development to execute False
Assemblies ITaskItem[] List of assemblies to use for execution. False
StopOnFirstFailure bool Stop the execution of the specification on the first failure. The default is false False
ContinueOnError bool It determines if the build should continue on task failure or if it must stop the build process. The default is true see MSBuild task False
Condition bool The task will be executed only if condition match see MSBuild task False

Elements

<Repository>

Attribute Type Description Required
Include Class Repository full class name True
Sub-element Type Description Required
Arguments Argument A set of repository arguments True
<Arguments>
Sub-element Type Description Required
Argument string repository argument like the Server Url True
</Arguments>

</Repository>

<Assemblies>

Attribute Type Description Required
Include string Assembly path True

</Assemblies>

<SystemUnderDevelopment>

Attribute Type Description Required
Include Class SystemUnderDevelopment full class name True
Sub-element Type Description Required
Arguments Argument A set of system under development arguments False
<Arguments>
Sub-element Type Description Required
Argument string system under developement argument True
</Arguments>

</SystemUnderDevelopment>

Requirements

Assembly: GreenPepper.Extensions

Examples

GreenPepperRepository

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <UsingTask TaskName="GreenPepper.MSBuild.GreenPepperTask" AssemblyFile="Lib\GreenPepper.Extensions.dll"/>

    <ItemGroup>
        <Assemblies Include="bin\MyFixtures.dll" />
        <Repository Include="Greenpepper.Repositories.GreenPepperRepository">
            <Arguments>
                <Argument><![CDATA[http://www.greenpeppersoftware.com/confluence/rpc/xmlrpc?handler=greenpepper1&sut=GreenPepperOpen - Core DotNet&includeStyle=false&postExecutionResult=${greenpepper.postExecutionResult}#GREENPEPPER]]></Argument>
            </Arguments>
        </Repository>
        <SystemUnderDevelopment Include="GreenPepper.Fixtures.MyCustomSystemUnderDevelopment">
            <Arguments>
                <Argument>foo</Argument>
            </Arguments>
        </SystemUnderDevelopment>
    </ItemGroup>

    <Target Name="GreenPepper">
        <GreenPepperTask
                Suite="true"
                Input="GreenPepper Confluence-GREENPEPPER"
                Output="GreenPepperReports"
                OutputType="plain"
                ContinueOnError="false"
                Repository="@(Repository)"
                SystemUnderDevelopment="@(SystemUnderDevelopment)"
                Assemblies="@(Assemblies)"></GreenPepperTask>
    </Target>
</Project>

FileSystemRepository

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <UsingTask TaskName="GreenPepper.MSBuild.GreenPepperTask" AssemblyFile="Lib\GreenPepper.Extensions.dll"/>

    <ItemGroup>
        <Assemblies Include="bin\MyFixtures.dll" />
        <Repository Include="Greenpepper.Repositories.FileSystemRepository">
            <Arguments>
                <Argument><![CDATA[C:\dev\GreenPepperFreezedSpec\GreenPepper .Net Seeds]]></Argument>
            </Arguments>
        </Repository>
        <SystemUnderDevelopment Include="GreenPepper.Fixtures.MyCustomSystemUnderDevelopment">
            <Arguments>
                <Argument>foo</Argument>
            </Arguments>
        </SystemUnderDevelopment>
    </ItemGroup>

    <Target Name="GreenPepper">
        <GreenPepperTask
                Suite="true"
                Input="GreenPepper Confluence-GREENPEPPER"
                Output="GreenPepperReports"
                OutputType="plain"
                ContinueOnError="false"
                Repository="@(Repository)"
                SystemUnderDevelopment="@(SystemUnderDevelopment)"
                Assemblies="@(Assemblies)"></GreenPepperTask>
    </Target>
</Project>

<FreezeTask>

MSBuild task that fetch specifications on local file system.

Have a look at this blog post : Put your specifications in the freezer

Parameters

Attribute Type Description Required
Repositories ITaskItem[] Repositories to fetch specifications from True
Output string Path to produce reports (defaults to current directory) False
Condition bool The task will be executed only if condition match see MSBuild task False

Elements

<Repositories>

Contains a set of <Repositories> ITaskItem :

Attribute Type Description Required
Include Class Repository full class name True
Sub-element Type Description Required
Arguments Argument A set of repository arguments True
Name string A name for you to identify a repository False
Suites Suite A set of specifications suite to freeze False
Tests Test A set of specifications tests to freeze False
<Arguments>
Sub-element Type Description Required
Argument string repository argument like the Server Url True
</Arguments>
<Suites>
Sub-element Type Description Required
Suite string The suite name True
</Suites>
<Tests>
Sub-element Type Description Required
Test string The test name True
</Tests>

</Repositories>

Requirements

Assembly: GreenPepper.Extensions

Examples

GreenPepperRepository

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="GreenPepper.MSBuild.FreezeTask" AssemblyFile="Lib\GreenPepper.Extensions.dll"/>
  <ItemGroup>
    <Repositories Include="Greenpepper.Repositories.GreenPepperRepository">
	<Arguments>
	  <Argument><![CDATA[http://www.greenpeppersoftware.com/confluence/rpc/xmlrpc?handler=greenpepper1&sut=GreenPepperOpen - Core DotNet&includeStyle=false&implemented=true#GREENPEPPER]]></Argument>
	</Arguments>
	<Tests>
	  <Test>GreenPepper Confluence-GREENPEPPER/Type conversion (.NET)</Test>
	</Tests>
	<Suites>
	  <Suite>GreenPepper Confluence-GREENPEPPER</Suite>
	</Suites>
	<Name>GreenPepper .Net Seeds</Name>
    </Repositories>
  </ItemGroup>

  <Target Name="Freeze">
	<FreezeTask
		Output="GreenPepperFreezedSpec"
		Repositories="@(Repositories)">
	</FreezeTask>
  </Target>

</Project>

To test this example copy the sample in GreenPepper_Freeze.proj and run it by :

msbuild GreenPepper_Freeze.proj /target:Freeze

FileSystemRepository

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask TaskName="GreenPepper.MSBuild.FreezeTask" AssemblyFile="Lib\GreenPepper.Extensions.dll"/>
  <ItemGroup>
    <Repositories Include="GreenPepper.Repositories.FileSystemRepository">
	<Arguments>
	  <Argument><![CDATA[C:\dev\octo-fev-09\octopus\GreenPepperFreezedSpec\GreenPepper .Net Seeds]]></Argument>
	</Arguments>
	<Tests>
	  <Test>GreenPepper Confluence-GREENPEPPER/Type conversion (.NET).html</Test>
	</Tests>
	<Suites>
	  <Suite>GreenPepper Confluence-GREENPEPPER</Suite>
	</Suites>
	<Name>Local GreenPepper .Net Seeds</Name>
    </Repositories>
  </ItemGroup>

  <Target Name="Freeze">
	<FreezeTask
		Output="GreenPepperFreezedSpec"
		Repositories="@(Repositories)">
	</FreezeTask>
  </Target>

</Project>

DEMONSTRATION LICENSE - This Confluence site is for demonstration purposes only. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.4.3 Build:#705 Mar 21, 2007) - Bug/feature request - Contact Administrators