Question

I am very new to TeamCity. I found that some xml does the trick like

<Gallio IgnoreFailures="true" ...

but I do not know wher to put this. How to invoke this. What steps to add in TeamCity. I would be greateful for any tutorial.

Was it helpful?

Solution

1 To your solution add a library project.
2 Edit a project (adding section below) and commit.

<!-- put this in csproj almost at the end in target section -->
<UsingTask AssemblyFile="Gallio directory - wherever it is insalled\bin\Gallio.MSBuildTasks.dll" TaskName="Gallio" />

<ItemGroup>
    <TestAssemblies Include="Path to your test project dll (ex ..\testProjName\bin\Debug\testProjName.dll" />
    <!-- put as many TestAssemblies as you want -->
</ItemGroup>

<!-- name of the target is important to rememver. You will use it in Team City Configuration -->
<Target Name="RunTests"> 
    <Gallio Files="@(TestAssemblies)" IgnoreFailures="false" ReportTypes="html" ShowReports="true">
    <!-- This tells MSBuild to store the output value of the task's ExitCode property
         into the project's ExitCode property -->
        <Output TaskParameter="ExitCode" PropertyName="ExitCode" />
    </Gallio>
    <Error Text="Tests execution failed" Condition="'$(ExitCode)' != 0" />
</Target>

3 Add an MSBuild step to build configuration. a) Runner Type: MSBuild b) Build File Path: Relative path to the test project. c) Targets: In example above target name is "RunTests" d) Fill all other fields accordingly. e) Save step

You should be already able to run and test your projects. If you believe that there is some other step that could be added here just edit my answer.

I have been looking for an answer for some time and found it partially on several sites, but nowhere as a whole. For example: other similar answer was not only partial, but had parameters that did not work in MsBuild 3.2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top