Newbie - Getting xUnit Tests to Run Via Gallio

Hi,

I'm a real newbie to configuring CI systems and have pretty much run out of ideas to try so I thought I'd post here.

I've been reading loads on the web about using Gallio to run as part of a TeamCity MSBuild task but have totally failed to get it to run so far.  I have looked at the examples in the TC docs and the Gallio docs and I can't see where my particular script differs from these examples.

My MSBuild script is this:

<?xml version="1.0" encoding="utf-8"?>


<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <UsingTask AssemblyFile="C:\Program Files\Gallio\bin\Gallio.MSBuildTasks.dll" TaskName="Gallio" />
    <ItemGroup>
        <ProjectToBuild Include="$(MSBuildProjectDirectory)\SampleSort.sln"></ProjectToBuild>
        <TestAssemblies Include="$(MSBuildProjectDirectory)\SampleSort.Tests\bin\Release\SampleSort.Tests.dll"></TestAssemblies>
    </ItemGroup>

    <Target Name="BuildSolution">
        <MSBuild Projects="@(ProjectToBuild)"
                 Targets="Rebuild"
                 Properties="Configuration=Release;Platform=x86">
            <Output TaskParameter="TargetOutputs" ItemName="BuildOutput"/>
        </MSBuild>
    </Target>
    
    <Target Name="Test">
        <RemoveDir Directories="Reports" Condition="Exists('Reports')"/>
        <MakeDir Directories="Reports"/>
        
        <Gallio IgnoreFailures="true"
                Files="@(TestAssemblies)"
                ReportDirectory="Reports"
                ReportTypes="html;xml"
                ShowReports="true" >
            <Output TaskParameter="ExitCode" PropertyName="ExitCode"/>
        </Gallio>
        <Error Text="Tests execution failed" Condition="'$(ExitCode)' != 0" />
    </Target>  
</Project>


The BuildSolution task runs exactly as expected however from looking at the full log after a build has run it doesn't even mention *anything* about the Test task, not even a fail message is in the log so I suspect that I'm missing a vital part of configuration somewhere.  As far as I can tell this mirrors example scripts I've seen others using so I'm a bit lost as to what I need to do.

The directory Reports is never present which leads me to believe that this task isn't even recognised by MSBuild as something it needs to do.

I'm not even going to delve into the report integration yet!!

Any help with this would be really appreciated, I've totally run out of ideas now.

Thanks,

James.

2 comments
Comment actions Permalink

Hmm ... I've made a bit of progress on this but this in itself is possibly more confusing.

If I comment out the Build Task the tests are run as expected ... if I include both tasks, the Build happens and then TC stops without even attempting to run the test task ...

0
Comment actions Permalink

Ahh, I have now fixed this problem.

I had neglected to list the Targets in the Build Runner "Targets" textbox.

My bad ...

0

Please sign in to leave a comment.